Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/210.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
Android ListView项目离开屏幕_Android_Xml_Android Studio_Listview_Kotlin - Fatal编程技术网

Android ListView项目离开屏幕

Android ListView项目离开屏幕,android,xml,android-studio,listview,kotlin,Android,Xml,Android Studio,Listview,Kotlin,问题是,当我运行程序时,视图会像上图所示那样剪切 我不知道到底是什么样的问题,所以如果你需要什么东西来展示,尽管问吧 顺便说一下,我正在使用kotlin 编辑1: result_row.xml这是ListView中显示的行的xml <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app=

问题是,当我运行程序时,视图会像上图所示那样剪切 我不知道到底是什么样的问题,所以如果你需要什么东西来展示,尽管问吧 顺便说一下,我正在使用kotlin

编辑1: result_row.xml这是ListView中显示的行的xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/itemName"
            android:layout_width="200dp"
            android:layout_height="40dp"
            android:gravity="center"
            android:text="Name"
            android:textColor="#000000"
            android:textSize="16sp" />


        <View
            android:id="@+id/lineView2"
            android:layout_width="2dp"
            android:layout_height="40dp"
            android:background="#010101" />

        <TextView
            android:id="@+id/itemWeight"
            android:layout_width="100dp"
            android:layout_height="40dp"
            android:gravity="center"
            android:text="Item Weight"
            android:textColor="#000000"
            android:textSize="16sp" />

        <View
            android:id="@+id/lineView1"
            android:layout_width="2dp"
            android:layout_height="40dp"
            android:background="#010101" />

        <TextView
            android:id="@+id/itemPrice"
            android:layout_width="100dp"
            android:layout_height="40dp"
            android:gravity="center"
            android:text="Price"
            android:textColor="#000000"
            android:textSize="16sp" />


    </LinearLayout>


</FrameLayout>

在布局xml文件中编辑

layout_width="0dp"
layoyt_height="0dp"

您的
TextView
s具有固定宽度,总宽度大于屏幕宽度:

android:layout_width="200dp"
...
android:layout_width="100dp"
...
android:layout_width="100dp"

Android手机可以窄到320dp,所以会被切断。您需要修改布局以使用可用空间,而不是硬编码固定宽度。或者,如果你真的想使用固定宽度,它们需要更小(加起来不应该超过
320dp
)。

不要使用固定宽度高度你能分享你的结果吗?“你能分享你的结果吗?\u row.xml?”当然“不要使用固定宽度高度”我试过了,但还是有一部分偏离了,有些文字从屏幕上消失了,我现在就试试看,看看发生了什么。尽管屏幕上出现了垃圾,但至少比以前好多了。。。我会把它标为thx