我有问题:在android studio的设计中看起来很完美,但当我在ganymotion或设备中运行我的应用程序时,我只有全屏的第二个布局这是我的源码
<RelativeLayout 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:id="@+id/choosetransactionuserimg"
>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/centerview"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:background="#D9c42251"
android:layout_above="@+id/centerview"
android:id="@+id/relativeLayout">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#000000"
android:layout_alignParentStart="true"
android:layout_below="@+id/centerview">
</RelativeLayout>

我不知道出了什么问题,如果有人知道解决方案,请帮助我,谢谢
发布于 2015-08-27 15:13:17
试试这个:
<RelativeLayout 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:id="@+id/choosetransactionuserimg"
>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:id="@+id/centerview"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:background="#D9c42251"
android:layout_above="@+id/centerview"
android:id="@+id/relativeLayout">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#000000"
android:layout_alignParentStart="true"
android:layout_below="@+id/centerview">
</RelativeLayout>发布于 2015-08-27 15:19:14
您需要使用here线性布局作为主布局。通过使用它,您将非常容易地管理您的屏幕。我正在使用这项专利,而我需要你所需要的类型设计。
下面是它的示例:
发布于 2015-08-27 16:05:17
检查它:

<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:id="@+id/choosetransactionuserimg"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight=".5"
android:background="#D9c42251"
android:id="@+id/relativeLayout">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="5dip"
android:id="@+id/centerview"
android:layout_gravity="center_vertical"
android:background="@android:color/white"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight=".5"
android:orientation="vertical"
android:background="@android:color/black"
android:layout_below="@+id/centerview"
android:id="@+id/relativeLayout2">
</LinearLayout>
</LinearLayout>https://stackoverflow.com/questions/32242762
复制相似问题