android tablerow 间隔,android-如何使TableRow从右到左
如何從右到左向TableRow添加視圖?默認模式為從左到右.我在TableLayout和TableRow中都嘗試了android:gravity =“ right”和android:layout_gravity =“ right”,但是沒有用.
例如:
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:layoutDirection="rtl"
android:stretchColumns="*" >
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="right"
android:layoutDirection="rtl">
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text" />
結果是左側的button1和右側的textView1,但反之亦然.
最佳答案
您的答案很簡單.與任何表一樣,您選擇的第一個條目將首先出現,在您的情況下為button1,您需要將其作為TextView放置在button1之前.
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:layoutDirection="rtl"
android:stretchColumns="*" >
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="right"
android:layoutDirection="rtl">
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text" />
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
總結
以上是生活随笔為你收集整理的android tablerow 间隔,android-如何使TableRow从右到左的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android retrofit 2.0
- 下一篇: 韵达辟谣“公司要倒闭”传言:故意抹黑、我