How can I add views to TableRow
right-to-left? the default mode is left-to-right. I tried android:gravity="right"
and android:layout_gravity="right"
inside both TableLayout
and TableRow
but didn't work.
for example:
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:layoutDirection="rtl"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="right"
android:layoutDirection="rtl">
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium Text" />
</TableRow>
</TableLayout>
the result is button1 at the left and textView1 at the right but I need vice versa .
ViewCompat.setLayoutDirection(tableRow,ViewCompat.LAYOUT_DIRECTION_RTL);