问题
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