Right align column in android table layout

浪尽此生 提交于 2019-12-03 22:47:04
Ram kiran

Here you have to do

  1. set the table row width to fill_parent

  2. and set the android:layout_gravity="right" to the textview which you want to align right it to the table row

    ---- or ----

  1. add the weight to the textview inside a table row so that they can align how you want.
  1. android:stretchColumns="x" where x is the column you want to fill
  2. android:layout_width="fill_parent" to ensure everything fills the screen
  3. android:layout_gravity="right" for the view component in column "x"

example (pseudo code):

<TableLayout
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:stretchColumns="1">

    <TableRow>
        <TextView android:text="Left Column" />
        <TextView android:layout_gravity="right|center_vertical" android:text="Right Adjusted Column" />
    </TableRow>

</TableLayout>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!