my list view in android seems like a square how to fix that and what is the error?

痴心易碎 提交于 2019-12-12 02:03:36

问题


I have an android application that uses php and mysql and after fetching the from the database, the result are displayed in a listView that is handled by a BaseAdapter.

The problem is that the rows in the list seem like a square.

can anyone tell me where the mistake is in the xml files ???

activity_user_list.xml

<?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:orientation="vertical"
android:background="@drawable/background_1">
<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
</LinearLayout>

list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/background_1"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/uid"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:visibility="gone" />

    <TextView
        android:id="@+id/name"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="text view"
        android:textColor="#FFFFFF"
        android:textSize="17dip"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/txtCreateDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="TextView"
        android:textColor="#FFFFFF" />

</RelativeLayout>

回答1:


Try remove the background of your relative layout.




回答2:


Try removing the background image from activity_user_list.



来源:https://stackoverflow.com/questions/23072869/my-list-view-in-android-seems-like-a-square-how-to-fix-that-and-what-is-the-erro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!