私は内部にテーブルレイアウトを持つCardViewを持っています。私のテーブルレイアウトでは、私は行の右端に表示するテキストビューが必要です。行の右端にテキストを置く
私のxml
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
card_view:cardUseCompatPadding="true"
app:cardElevation="@dimen/cardView_elevation"
app:cardCornerRadius="@dimen/cardView_radius"
card_view:cardBackgroundColor="@color/cardView_background">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp" android:layout_marginBottom="10dp">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/row_background"
android:padding="2dp">
<TextView
android:text="Under Weight"
style="@style/RowLabel" android:textColor="@android:color/holo_orange_light"/>
<TextView
android:text="<18.5"
style="@style/RowVal" android:textColor="@android:color/holo_orange_light"/>
</TableRow>
は...私のスタイル
上記と同様のいくつかの他の行:
<style name="RowLabel" parent="@android:style/TextAppearance">
<item name="android:textSize">14.0sp</item>
<item name="android:paddingLeft">10.0dip</item>
<item name="android:paddingRight">20.0dip</item>
</style>
<style name="RowVal" parent="@android:style/TextAppearance">
<item name="android:textSize">14.0sp</item>
<item name="android:paddingLeft">20.0dip</item>
<item name="android:paddingRight">10.0dip</item>
</style>
画像:
重力aを使用xtream in xml – SaravInfern
gravity = "end"またはgravity = "right"はあなたの問題を解決します –