Android:ListView';s高度不小于';t等于其父代';它的高度,但不明显
我有一个包含项目的Android:ListView';s高度不小于';t等于其父代';它的高度,但不明显,android,listview,Android,Listview,我有一个包含项目的列表视图。每个项目的高度包装其内容。但是,ListView通过展开到其父项的底端而不显示其项 我的问题是:为什么 这里是布局图 项目 列表视图,使用父视图的高度 如果这就是布局中的全部内容,那么您实际上不需要使用约束布局——应该使用带有布局权重的常规线性布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/a
列表视图
。每个项目的高度包装其内容。但是,ListView
通过展开到其父项的底端而不显示其项
我的问题是:为什么
这里是布局图
项目
列表视图,使用父视图的高度
如果这就是布局中的全部内容,那么您实际上不需要使用
约束布局
——应该使用带有布局权重的常规线性布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/seals_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/choose_seal" />
<ListView
android:id="@+id/handle_publication_share_list_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:layout_marginTop="8dp" />
</LinearLayout>
如果这就是布局中的全部内容,那么您实际上不需要使用约束布局
——应该使用带有布局权重的常规线性布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/seals_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/choose_seal" />
<ListView
android:id="@+id/handle_publication_share_list_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:layout_marginTop="8dp" />
</LinearLayout>
在一小时后删除并重新发布您的问题通常不是获得答案的最佳方式。删除的问题与另一个问题有关,而这个问题可能与此问题有关。这就是我删除它的原因。顺便说一句,为谁阅读删除的问题(您应该编辑您的评论以删除它):当前问题中的ImageBitmap
没有任何更改。除了项目中的imageView的高度外,所有内容看起来都很好,尝试一些修复方法,而不是包装内容,并在项目的图像视图的高度随图像视图的位图图像的功能而变化时再次进行测试。因此,我无法确定项目的高度删除并在一小时后重新发布您的问题通常不是获得答案的最佳方式删除的问题必然会涉及到另一个问题,也可能涉及到这个问题。这就是我删除它的原因。顺便说一句,为谁阅读删除的问题(您应该编辑您的评论以删除它):当前问题中的ImageBitmap
没有任何更改。除了项目中的imageView的高度外,所有内容看起来都很好,尝试一些修复方法,而不是包装内容,并在项目的图像视图的高度随图像视图的位图图像的功能而变化时再次进行测试。所以我不能确定项目的高度,你认为这是因为约束布局吗?这是我的假设。可能有一种方法可以在仍然使用ConstraintLayout
的情况下修复它,但是LinearLayout
只是一种更简单、更直接的解决方案。您的假设很好!这是一个应该由谷歌修复的错误吗?你认为这是因为约束布局吗?这是我的假设。可能有一种方法可以在仍然使用ConstraintLayout
的情况下修复它,但是LinearLayout
只是一种更简单、更直接的解决方案。您的假设很好!这是一个应该由谷歌修复的bug吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/seals_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/choose_seal" />
<ListView
android:id="@+id/handle_publication_share_list_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:layout_marginTop="8dp" />
</LinearLayout>