1
すべてのアンドロイドデバイス用にデザインを作成したいと思います。このために、私は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に設定しないと、多分、 –