【发布时间】:2014-05-09 07:43:30
【问题描述】:
我有类似“有 200 欧元”之类的内容,但我想设置该值的样式(例如 textColor Red)
有没有办法让两个 textView 看起来像一个完整的?
textView 或 textViewContainer 内的 textView 或其他东西。
我可以像这样回答:Change text color of one word in a TextView
但我想从布局文件中做。有机会吗?
谢谢
编辑
<TextView
android:id="@+id/lastIncome"
android:text="Tu último ingreso fueron"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dash_font_size"/>
<TextView
android:id="@+id/lastIncomeValue"
android:text="200€"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dash_value_font_size"
android:textColor="@color/greensea"
android:layout_gravity="right"/>
【问题讨论】:
-
请贴一些代码。例如,发布文本视图的创建和布局方式。
-
只有两个文本视图。忘记其他一切。只想要一个简单的动作,在同一行上用另一种样式的新 textView 继续
-
请把代码贴出来。
-
没有人提供答案,即使我发布了代码。这不可能。也许您更愿意为每个屏幕尺寸更改 textSize 以将您的 textView 并排放置。
-
如果这甚至是你所关心的问题,你可以查看这个库:github.com/quiqueqs/BabushkaText Spannables 是我认为你正在寻找的东西