Android 在顶部、其他布局内部对齐布局
我有两个碎片,第一个里面有第二个。这是第一个:Android 在顶部、其他布局内部对齐布局,android,android-layout,android-linearlayout,android-relativelayout,Android,Android Layout,Android Linearlayout,Android Relativelayout,我有两个碎片,第一个里面有第二个。这是第一个: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_details_bg"
android:orientation="vertical" >
<TextView
android:id="@+id/fragmentDetailTitle"
style="@style/textTitleDetailStyle" />
<LinearLayout
android:id="@+id/detailSubObjectFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical" >
</LinearLayout>
<Button
android:id="@+id/fragmentDetailButtonGo"
style="@style/goButtonStyle" />
</RelativeLayout>
在布局细节子对象框架内,我还有其他片段。在这种情况下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sub_take_error_Layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<LinearLayout
android:id="@+id/numberErrorLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="horizontal" >
<com.mypackage.NumberPickerCustom
android:id="@+id/numberPickerCustomRandom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
max="100"
min="1"
value="30" />
<TextView
android:id="@+id/moreText"
style="@style/textOnSubmenu"
android:textSize="20sp"
android:text="@string/moreErrorText" />
</LinearLayout>
<LinearLayout
android:id="@+id/myLayoutTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="horizontal" >
<TextView
android:id="@+id/numberOfQuestion"
style="@style/textOnSubmenu"
android:textSize="20sp"
android:text="@string/numberOfErrorQuestionText" />
<TextView
android:id="@+id/numberOfQuestionValue"
style="@style/textOnSubmenu"
android:textSize="20sp"
android:text="6" />
</LinearLayout>
</RelativeLayout>
我希望布局“myLayoutTop”将放置在第一个片段fragmentDetailTitle的textview的正下方。(不从中心移动其他布局)。
正如你所看到的,我尝试了布局,但没有成功。
如果需要,我只能完全更改第二个片段的布局,我的约束条件是numberErrorLayout应该保持(像现在一样)在屏幕中央。我刚刚更改了FrameLayout中DetailSubObject Frame的布局和LinearLayout中sub_take_error_布局。在我使用numberErrorLayout和myLayoutTop的属性gravity之后