我想在我的文本视图居中一些代码,但它似乎是持续左对齐:TextView的文本不居中
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_above="@+id/myButtons">
<!-- Text -->
<TextView
android:id="@+id/myText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="22sp"
android:text="Test"
android:textStyle="bold" />
<!-- And the thumbnail -->
<ImageView
android:id="@+id/image"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/image_text"
android:layout_gravity="center" />
</LinearLayout>
图像(当有一个,有时它被设置为可见。去)是中心对齐好吗。这只是我无法让文字居中对齐。
任何想法的欢迎。谢谢!
你有没有后试过我的答案? – Nambi
是的,我回答了你的回答:) – b85411
我编辑了我的答案看看 – Nambi