我对布局android有疑问。 这是我想要制作的布局图像。像这样:
这是图像例证:
这是我的代码:
<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:background="@drawable/first_screen_bg"
tools:context=".LoginActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100" >
<LinearLayout
android:id="@id/linerTop"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="55"
android:background="@color/white"
android:orientation="vertical" >
</LinearLayout>
<RelativeLayout
android:id="@id/linerBottom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="45"
android:background="@color/grey" >
<LinearLayout
android:id="@id/linerMidle"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="top|center"
android:background="@color/black" >
</LinearLayout>
<RelativeLayout
android:id="@id/linerFlag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="-20dp"
android:background="@drawable/login_flag" >
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout><RelativeLayout>
</RelativeLayout>
但它没有运行。
请帮帮我。感谢
答案 0 :(得分:0)
将layout.xml更改为:
<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:background="@drawable/first_screen_bg"
tools:context=".LoginActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100" >
<LinearLayout
android:id="@id/linerTop"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="55"
android:background="@color/white"
android:orientation="vertical" >
</LinearLayout>
<RelativeLayout
android:id="@id/linerBottom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="45"
android:background="@color/grey" >
<LinearLayout
android:id="@id/linerMidle"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="top|center"
android:background="@color/black" >
</LinearLayout>
<RelativeLayout
android:id="@id/linerFlag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="-20dp"
android:background="@drawable/login_flag" >
</RelativeLayout>
</RelativeLayout>
</LinearLayout>