Android: TableLayout alinear la primera columna a la derecha, la segunda a la izquierda
¿Qué debo hacer para obtener algo así:
- El intervalo de TableRow no funciona para filas añadidas dinámicamente
- Android: Tablerow multiline textview recorte verticalmente
- ¿Cómo se agrega dinámicamente una vista desde el archivo xml, quiero agregar TableRow en RelativeLayout
- Problemas de la suma de peso de TableLayout
- Cómo agregar TableRow de xml a TableLayout mediante programación?
Puedo hacerlo sin problemas en HTML, pero ¿cómo en Android?
- Cómo configurar la columna de diseño de la vista en código (la vista está dentro de tablerow)?
- Android - ¿Espacio entre TextView y Togglebutton?
- Android TableRow RelativeLayout problema
- Android programatically establecer margen a ImageButton en TableRow
- Android y mostrar texto de múltiples líneas en un TextView en un TableRow
- No se muestran filas de tabla añadidas dinámicamente
- 'La previsualización se agotó al renderizar el bucle de diseño infinito o la recursión ilimitada' cuando duplicaba algunos TableRows
- Obtener todos los TableRow en un TableLayout
Use TextViews and gravity <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:text="key" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="left" android:text="value" /> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:text="More key" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="left" android:text="More value" /> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:text="Even more key" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="left" android:text="Even more value" /> </TableRow> </TableLayout>
Write first TextView wight=1 and second TextView wight=2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:text="key" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="2" android:gravity="left" android:text="value" /> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:text="More key" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="2" android:gravity="left" android:text="More value" /> </TableRow> <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:text="Even more key" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="2" android:gravity="left" android:text="Even more value" /> </TableRow> </TableLayout> </LinearLayout>
En columnas de su TableLayout
debe utilizar TextView
para mostrar el contenido.
Así que para la primera columna, prueba esto,
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:text="Key" android:textColor="@android:color/black"/>
Y para la segunda columna intentar esto,
<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="left" android:text="Value" android:textColor="@android:color/black"/>
- Crashlytics encontró una clave de API no válida – AndroidStudio build
- Problemas de serialización de RealmList (Realm / Gson / Intent)