0

Is it possible change size of temperature?

remoteViews.setTextColor(R.id.battery, Color.WHITE);
        remoteViews.setTextViewText(R.id.battery, String.valueOf((int)batteryLevel + "%" + "|" + temperatura + "°C"));

Batterylevel and temperature are in the same textview. I want change size only of temperature. Actually is 50dp. I want 20dp.Hopw can i do it?

4

1 回答 1

1

您可以使用 HTML 代码更改尺寸,但我认为无法在 dp 中指定详细尺寸。

在你的情况下,我会使用温度标签<small>

remoteViews.setTextColor(R.id.battery, Color.WHITE);
String styledText = String.valueOf((int)batteryLevel) + "%" + "|" + "<small>" + temperatura + "°C</small>";
remoteViews.setTextViewText(R.id.battery, Html.fromHtml(styledText));

此处描述了支持的标签列表:http: //www.grokkingandroid.com/android-quick-tip-formatting-text-with-html-fromhtml/

于 2013-08-23T01:28:34.077 回答