android - 如何在屏幕上水平分割屏幕

标签 android orientation android-linearlayout

现在它垂直拆分...我希望它水平拆分。我看过其他所有人都说他们的水平切割,但我无法分辨其中的区别...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="top"
    android:layout_weight="1" >
</LinearLayout>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="bottom"
    android:layout_weight="1" >
</LinearLayout>

</LinearLayout>

最佳答案

将方向更改为垂直

  <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

 <LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_weight=".1" >
 </LinearLayout>

 <LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_weight=".1" >
</LinearLayout>

 </LinearLayout>

关于android - 如何在屏幕上水平分割屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12934712/

相关文章:

android - 无法在线性布局中的第一个图像下方设置另一个图像

android - 无法使用 Picasso 从 URL 设置 LinearLayout BackgroundResource

android - 如何将关闭的 ImageView 放在对话框的右上角并带有边距?

java - 使用蓝牙设备自动连接至 Android 手机

android - 应用程序未安装错误

android - 无法解析符号 AsyncHttpClient

java - 边框布局方向

java - 如果不使用,蓝牙套接字上的输入流读取将挂起

view - Windows 8 应用程序开发 : can't change Display Mode in Visual Studio 2012

android - Shared-preferences 仅适用于 Fragment Activity