TabHost – cómo cambiar el texto de la pestaña en XML
Sé la solución de cómo cambiarlo de forma programática, sin embargo, me gustaría establecer el texto en XML. ¿Cómo haces eso? He mirado aquí: http://developer.android.com/reference/android/widget/TabHost.html pero no encontré ninguna solución.
- El teclado suave levanta tabhost hacia arriba
- TabHost and tabWidget icon problema
- Cómo cambiar las pestañas Imágenes en el TabHost
- Android Exception: ¿Te olvidaste de llamar a 'public void setup (LocalActivityManager activityGroup)'
- Cómo restablecer Id de item list_view en cada ficha en TabHost?
- Fragmentos no visibles después de cambiar tabulación en FragmentTabHost anidado
- Lengüetas de diferentes tamaños en Android
- Inflar un diseño con ImageButton en Fragmento mediante programación
- Listview en el lado de rleft y tabhost en el lado derecho con la proporción de 20:80 compartir pantalla
- Cómo implementar pestañas ahora que TabActivity está obsoleto
- ¿Es posible descargar actividades en línea y cargarlas en pestañas en Android?
- Android TabHost dentro de Fragmento
- Nullpointer excepción en oncreateView () de fragmento
Qué tal si ….
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <TabHost android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:tag="tab0" android:text="Tab 1" android:background="@android:drawable/btn_star_big_on" android:layout_width="wrap_content" android:layout_height="fill_parent" /> <TextView android:tag="tab1" android:text="Tab 2" android:layout_width="wrap_content" android:layout_height="fill_parent" /> <TextView android:tag="tab2" android:text="Tab 3" android:layout_width="wrap_content" android:layout_height="fill_parent" /> </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:text="Hallo1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <TextView android:text="Hallo2" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <TextView android:text="Hallo3" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </FrameLayout> </LinearLayout> </TabHost> </RelativeLayout>
De esta manera se verá como sigue:
Compruebe la muestra completa de la pestaña aquí .
Espero que esto ayude … ¡Salud!
Siempre puedes ir a @ + id / tab1 y cambiarlo a lo que quieras que se llame la pestaña. Así que si quieres que se llame "Acerca de" simplemente cambia a @ + id / About en el diseño lineal para la pestaña específica.