我想在视图底部并排设置2个按钮来设置我的linearlayout。
今天,使用我的代码,线性布局位于顶部:(
我的错误在哪里?
<LinearLayout 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:background="#0099CC"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:orientation="vertical" >
<Button
android:id="@+id/startact_btn_connect"
style="?android:attr/borderlessButtonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/bg_blue_button_login"
android:text="Se connecter"
android:textColor="@color/blanc" />
<View
android:layout_width="fill_parent"
android:layout_height="3dp"
android:layout_marginBottom="10dp"
android:background="@color/blue_pressed" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:orientation="vertical" >
<Button
android:id="@+id/startact_btn_view_annonces"
style="?android:attr/borderlessButtonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/bg_blue_dark_button_login"
android:text="Voir les annonces"
android:textColor="@color/blanc" />
<View
android:layout_width="fill_parent"
android:layout_height="3dp"
android:layout_marginBottom="10dp"
android:background="@color/blue_dark_pressed" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
设置android:layout_height="match_parent"
为LinearLayout的第一个孩子
<LinearLayout 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:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="bottom" >
<!-- content -->
</LinearLayout>
</LinearLayout>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句