我正在爲每行創建一個包含圖像,文本和複選框的列表。我使用Table Layout,但我想將複選框的位置移動到右側,gravity:right
沒有工作。我能爲此做些什麼? 代碼:右側列表中的Android複選框
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow>
<ImageView
android:id="@+id/img"
android:layout_width="50dp"
android:layout_height="50dp"/>
<TextView
android:id="@+id/txt"
android:layout_width="wrap_content"
android:layout_height="50dp" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:text=""
/>
</TableRow>
</TableLayout>
嘗試設置CheckBox的權重。 –
非常感謝你,它的工作 – user3553928
@JagdeepSingh請爲此寫一個答案,只要你做好評論我的回答,我會刪除它 –