Запитання з тегом «layout-gravity»

5
Android - Центр перегляду TextView горизонтально в LinearLayout
У мене є такий базовий макет <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/title_bar_background"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textAppearance="?android:attr/textAppearanceLarge" android:padding="10dp" android:text="HELLO WORLD" /> </LinearLayout> <LinearLayout> Здається, що xml правильний, але текст вирівняний зліва. Перегляд тексту займає всю ширину батьківського перегляду, а перегляд тексту встановлюється по центру. Не впевнений, …
Використовуючи наш веб-сайт, ви визнаєте, що прочитали та зрозуміли наші Політику щодо файлів cookie та Політику конфіденційності.
Licensed under cc by-sa 3.0 with attribution required.