Android 具有LinearLayout子级的ScrollView未正确包装\u内容
因此,我有以下.xml:Android 具有LinearLayout子级的ScrollView未正确包装\u内容,android,layout,Android,Layout,因此,我有以下.xml: <?xml version="1.0" encoding="utf-8"?> <ScrollView 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"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.scopesystems.cityalert.ui.Despre"
tools:showIn="@layout/app_bar_despre"
android:background="@drawable/toolbar_incercare">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/linear_parent">
<RelativeLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.1" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="2.8" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--General-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/sectionHeader"
android:text="@string/general"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/despre_general"/>
<!--Evaluti-ne-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/sectionHeader"
android:text="@string/evaluatine"
/>
<!--Confidentialitate si licente-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/sectionHeader"
android:text="@string/confidentialitate"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/despre_politici"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.1" />
</LinearLayout>
</ScrollView>
问题是最后一个
ListView
仅在一行上,必须滚动它才能显示列表中的所有项目。我试图在线性\u parent
中添加一个匹配\u parent
的高度,但它不允许我这样做,它说我应该使用wrapcontent
。如何更改布局以在所有屏幕上显示项目,而不仅仅是半个屏幕?在这种情况下,在ScrollView上使用android:fillViewport=“true”,对于ScrollView的子级android:height=“wrap\u content”
在ScrollView中添加此代码;android:fillViewport=“true”wrap\u content
ListView
s是个坏主意,这可能是你的错误problem@Murat我已经试过使用android:fillViewport=“true”了,现在确实可以用了!好的,如果它有效的话,我添加了这个问题解决方案的答案。