Android:如何将LinearLayout分成大小完全相同的两部分?

标签 android

我有以下布局:

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

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:name="ch.lexs.view.LawList"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_weight="1">
    </fragment>

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:name="ch.lexs.view.ParagraphList"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_weight="1">
    </fragment>

</LinearLayout>

我的 Intent 是将 LinearLayout 分成两个大小完全相同的部分。我认为这可以通过使用重量来完成。但是第二个 fragment 要小得多。我做错了什么?

最佳答案

尝试将两者的宽度设置为“fill_parent”。

关于Android:如何将LinearLayout分成大小完全相同的两部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5967727/

相关文章:

android - 领英通讯失败

android - 当设备处于 sleep 模式时,AlarmManager.setInexactRepeating 是否可以不广播 Intent ?

android - 返回 RESULT_CANCELED 的 Google 登录 fragment

android - 如何删除搜索栏拇指填充?

android - 错误 :Lambda coming from jar file need their interfaces on the classpath to be compiled RxJava2

java - 我已经在 gradle 编译 'com.firebaseui:firebase-ui-auth:2.3.0' 中编写了这一行,但仍然收到错误 "cannot resolve symbol ' Auth UI'”

java - 无法对数组元素求和?

Android Activity 指示器?

android - 如何将 Floating Action Button 带出应用程序并使其作为可见、可移动和可点击的后台服务运行?

android - Jetpack Navigation Deep Link 与错误的 ActionBar 按钮