Root LinearLayout does not allign center

时间:2015-10-30 23:59:43

标签: android android-layout nested

The Root code is below: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/satranc" android:layout_width="fill_parent" android:layout_height="@dimen/boy" android:gravity="center_horizontal" android:orientation="vertical" tools:context=".MainActivity"> The root tag is closed. Can anyone help? Thank you in advance

1 个答案:

答案 0 :(得分:0)

好吧,我尝试过威廉的解决方案但是没有用。然而,按照他之前的评论,我在所有嵌套的LinearLayouts中使用了android:gravity =“center_horizo​​ntal”,水平方向和VOILA!有效。 关心并感谢所有贡献者...