Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ListView上的高度项未更改_Java_Android - Fatal编程技术网

Java ListView上的高度项未更改

Java ListView上的高度项未更改,java,android,Java,Android,我必须在列表视图中更改单元格的高度,但在我的项目中找不到定义此高度的位置。我查看了包含list_view_item.XML的XML文件,但我在其中所做的任何更改都没有结果。我甚至用自己的xml文件更改了整个xml文件,但高度仍然很大。 在其他地方我可以找到定义的高度。 我正在处理通常添加到视图容器中的片段 我寻找我的问题,但我没有找到答案。 以下是我定义项目的XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout x

我必须在列表视图中更改单元格的高度,但在我的项目中找不到定义此高度的位置。我查看了包含list_view_item.XML的XML文件,但我在其中所做的任何更改都没有结果。我甚至用自己的xml文件更改了整个xml文件,但高度仍然很大。 在其他地方我可以找到定义的高度。 我正在处理通常添加到视图容器中的片段

我寻找我的问题,但我没有找到答案。 以下是我定义项目的XML:

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/splash_ll"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:paddingBottom="0dp"
android:paddingLeft="5dp"
android:weightSum="3.5" >

<ImageView
    android:id="@+id/splash_list_img"
    android:layout_width="0dp"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:maxHeight="@dimen/max_height"
    android:minHeight="@dimen/min_height"
    android:scaleType="fitXY"
    android:src="@drawable/s0" />

<TextView
    android:id="@+id/splash_list_txt"
    android:layout_width="0dp"
    android:layout_height="fill_parent"
    android:layout_weight="2"
    android:ellipsize="marquee"
    android:gravity="center|left"
    android:padding="5dp"
    android:singleLine="true"
    android:textSize="@dimen/text_size"
    android:textStyle="bold" />

<ImageView
    android:id="@+id/splash_list_bookmark"
    android:layout_width="0dp"
    android:layout_height="fill_parent"
    android:layout_weight=".5"
    android:adjustViewBounds="true"
    android:gravity="center|left"
    android:scaleType="fitCenter"
    android:padding="5dp"
    android:src="@drawable/bookmark_normal" />

</LinearLayout>

在何处/如何在其他地方定义此高度。
提前谢谢

因为它是一个列表项,所以您不希望LinearLayout的layout_height属性设置为“fill parent”;相反,尝试将其设置为“包装内容”


如果这不能解决您的问题,请详细说明情况,我可能会提供更多帮助


祝你好运

我终于在adapter in getView方法中找到了问题的根源,当XML文件膨胀时,我出现了以下错误: “避免将null作为视图根传递”(R.layout.bookmark\u list\u view,null),并且必须使用以下内容进行更改: LayoutFlater.充气(R.layout.bookmark_list_view,parent,false), 为了产生任何影响,list_view_item.xml根高度将更改

我希望这个答案将来能帮助别人

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/splash_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="0dp"
android:paddingLeft="5dp"
android:weightSum="3.5" >