【发布时间】:2016-09-12 12:17:34
【问题描述】:
我想把我的屏幕垂直分成两半,每一半做不同的颜色,
我试图使用这里提到的这个解决方案>
Android: 2 relative layout divided in half screen
但它对我不起作用。
这是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".activities.alignmentActivities.Add_New_Project_Activity"
tools:showIn="@layout/app_bar_add__new__project_">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#f00000"
android:layout_weight="1">
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:background="#00b0f0"
android:layout_height="wrap_content"
android:layout_weight="1">
</RelativeLayout>
</LinearLayout>
我怎样才能达到 2 个布局的预期效果,每个布局占屏幕垂直的一半\我做错了什么然后链接中提到的示例?
【问题讨论】:
-
将
android:layout_height="wrap_content"更改为match_parent -
要垂直分屏吗?
-
“但它对我不起作用”是什么意思?你具体做了什么?发生了什么?
标签: android android-studio layout