1
我想为每个Android设备进行设计。为此,我使用LinearLayouts的高度和百分比解决方案。LinearLayout通过使用weight属性(高度)来切断TextView文本
屏幕被分成许多部分(带权重的LinearLayouts)。在这些LinearLayouts中是元素,就像一个TextView。
但是,如果我与高度的LinearLayout可以切断底部的TextView。
如何根据权重动态更改文本大小?
代码:
<LinearLayout
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_weight="0.04"
android:weightSum="1">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.05799" />
<LinearLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.86951">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Benachrichtigungen"
android:textStyle="bold"
android:textSize="20sp"
android:id="@+id/header"/>
</LinearLayout>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="0.0722106" />
</LinearLayout>
图片:
屏幕截图和您当前的xml可能有助于更快地回答这个问题。 –
我已更新我的问题。谢谢你的建议。 :) –
你需要约束你的身高吗?如果没有设置外部LinearLayout高度wrap_content也许。 –