Hyp*_*erX 7 android android-layout android-linearlayout
我想在android studio中重新编写以下布局:

因为我在android的东西是新的,我首先尝试使用LinearLayout,并认为这可能是不可能的.现在我正在尝试使用RelativeLayout我已经用颜色创建了这个块:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="80dp"
android:background="@color/red_top">
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
现在我想问一下,如何将它分开,就像在顶部的图像1条和同一布局的底部的2条所示,我怎样才能放置相同的边框?
Ris*_*ava 18
您可以使用以下xml代码执行此操作:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/custom_toast_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#CD96CD"
android:text="TEXT" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:background="#CD96CD"
android:text="TEXT" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#000000" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:background="#CD96CD"
android:text="TEXT" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16596 次 |
| 最近记录: |