Android 如何将不同控件的活动划分为3个部分
这是我的屏幕目前看起来像这样。我必须做的布局3垂直分区第一个谷歌地图,第二个名称显示,第三个聊天窗口,实际上我有这样的布局10个部分划分为4:2:4 3像这样的布局。请帮助我,我不能这样做 试试这个Android 如何将不同控件的活动划分为3个部分,android,Android,这是我的屏幕目前看起来像这样。我必须做的布局3垂直分区第一个谷歌地图,第二个名称显示,第三个聊天窗口,实际上我有这样的布局10个部分划分为4:2:4 3像这样的布局。请帮助我,我不能这样做 试试这个 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="m
<?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:orientation="vertical" >
<RelativeLayout
android:id="@+id/contact_relMainHeader"
android:layout_width="match_parent"
android:layout_height="50dip"
android:background="#16A180"
android:padding="5dp" >
<ImageView
android:id="@+id/contact_btnMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:src="@drawable/scrol" />
<ImageView
android:id="@+id/contact_btnLogout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:src="@drawable/lock" />
<ImageView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:src="@drawable/centertext" />
</RelativeLayout>
</RelativeLayout>
将帮助您获得所需的结果。我可以在不编写代码的情况下向您解释逻辑(…您需要付出努力)。您的布局应该有3个片段
<?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:orientation="vertical" >
<RelativeLayout
android:id="@+id/contact_relMainHeader"
android:layout_width="match_parent"
android:layout_height="50dip"
android:background="#16A180"
android:padding="5dp" >
<ImageView
android:id="@+id/contact_btnMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:src="@drawable/ic_launcher" />
<ImageView
android:id="@+id/contact_btnLogout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:src="@drawable/ic_launcher" />
<ImageView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
<LinearLayout
android:layout_below="@+id/contact_relMainHeader"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_weight="40"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="#ff0000"
android:orientation="vertical"
>
</LinearLayout>
<LinearLayout
android:layout_weight="20"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:background="#000000"
>
</LinearLayout>
<LinearLayout
android:layout_weight="40"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:background="#ffff00"
>
</LinearLayout>
</LinearLayout>
</RelativeLayout>