【发布时间】:2026-01-19 06:00:01
【问题描述】:
大家好,
我一直在到处寻找,但似乎找不到解决方案。我在 LinearLayout 内的 ScrollView 内使用 LinearLayout,LinearLayout -> ScrollView -> LinearLayout。但是它不会在我想要的时候展开,而是裁剪我的布局。
有人知道我在这里缺少什么吗?可能有点乱,但尝试了很多东西
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/image_slider_menu"
layout="@layout/image_slider"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/menu"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:id="@+id/bars_map"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:padding="10dp"
android:src="@drawable/maps" />
<TextView
android:id="@+id/report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="8"
android:gravity="left|center_vertical"
android:text="Meld Misbruik"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="15dp">
<TextView
android:id="@+id/bar_view_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="title"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:id="@+id/bar_view_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="description"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/menu"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingTop="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Contact"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:id="@+id/bar_view_contact"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Gegevens" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
【问题讨论】:
-
按照你们的建议进行了更改。它已展开(文本在底部消失),但我无法在那里滚动。我现在要回家了,我稍后再看看。无论如何,谢谢!
-
问题在于权重值。我删除了它们,给出了一些高度并包装了内容,现在它又开始滚动了....但是这并没有使它响应。
标签: android xml scrollview android-linearlayout android-layout-weight