私はこれを私のレイアウトの一部として持っています:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:orientation="horizontal"
android:layout_weight="0.15">
<TextView
android:id="@+id/question_text"
android:layout_width="0dip"
android:layout_height="fill_parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/score_label" />
<TextView
android:id="@+id/score_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right" />
</LinearLayout>
最初TextViewのものは、アプリケーションの開始時に空です。その内容は動的に変更されます。これにより、スペースがゼロになり、に設定されTextViewていても、秒が左に揃えられます。layout_gravityright
内容を考慮せずに、どうすれば固定幅にすることができますか?
を使用することを考えましlayout_weightたが、ネストされた重みを使用しないことをお勧めします(親ViewGroupにはlayout_weight属性があります)。多分私は使用する必要がありRelativeLayoutますか?
提案をありがとう。