Android 可展开视图下方的布局不可见?
//只有上面的代码可见 //下面的代码不可见 //下面是scrollview中的详细信息Android 可展开视图下方的布局不可见?,android,android-layout,android-layout-weight,Android,Android Layout,Android Layout Weight,//只有上面的代码可见 //下面的代码不可见 //下面是scrollview中的详细信息 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/linearLayoutUser" > <!-- TODO: Update bla
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/linearLayoutUser"
>
<!-- TODO: Update blank fragment layout -->
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:groupIndicator="@null"
android:layout_gravity="left|top"
android:layout_weight="1"
/>
设置正确的
android:layout\u weight
和android:layout\u height
值
<ScrollView
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
>
</scrollView>
</LinearLayout>
//你的作品
设置正确的android:layout\u weight
和android:layout\u height
值
<ScrollView
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
>
</scrollView>
</LinearLayout>
//你的作品
将xml更改为:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/linearLayoutUser">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:groupIndicator="@null"
android:layout_gravity="left|top"
android:layout_weight="1"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:fillViewport="true">
// your work
</ScrollView>
</LinearLayout>
将xml更改为:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/linearLayoutUser">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_height="0dp"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:groupIndicator="@null"
android:layout_gravity="left|top"
android:layout_weight="1"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:fillViewport="true">
// your work
</ScrollView>
</LinearLayout>
重量有两个属性。 1) 布局重量
2) 加权和 在容器/父级(lineaLayout)中,您应该设置layout_weightsum,它是您在此布局中使用的权重总量 这里,有两个项目的线性布局,两个项目的高度必须相同 您将为每个布局设置2的总和,并为每个子布局设置1的权重 希望这会有帮助
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayoutUser"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="left|top"
android:layout_weight="1"
android:groupIndicator="@null" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<!--Scroll view with only one direct child-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--Do your work here-->
</LinearLayout>
</ScrollView>
</LinearLayout>
重量有两个属性。 1) 布局重量
2) 加权和 在容器/父级(lineaLayout)中,您应该设置layout_weightsum,它是您在此布局中使用的权重总量 这里,有两个项目的线性布局,两个项目的高度必须相同 您将为每个布局设置2的总和,并为每个子布局设置1的权重 希望这会有帮助
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayoutUser"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="left|top"
android:layout_weight="1"
android:groupIndicator="@null" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<!--Scroll view with only one direct child-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--Do your work here-->
</LinearLayout>
</ScrollView>
</LinearLayout>