Android 列表视图每页仅显示一个数据
我正在从MySQL数据库加载列表视图中的数据,一切正常,除了我的列表视图显示每页一个数据,如果我向下滚动,则显示第二个数据,如果我再次向下滚动,则显示第三个数据。它没有一个接一个地出现。那么问题是什么,我是否需要设置任何属性或任何其他内容。请帮助我下面是我的代码 我的XML:Android 列表视图每页仅显示一个数据,android,mysql,android-listview,Android,Mysql,Android Listview,我正在从MySQL数据库加载列表视图中的数据,一切正常,除了我的列表视图显示每页一个数据,如果我向下滚动,则显示第二个数据,如果我再次向下滚动,则显示第三个数据。它没有一个接一个地出现。那么问题是什么,我是否需要设置任何属性或任何其他内容。请帮助我下面是我的代码 我的XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/classes_slider"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back_bg"
android:orientation="vertical" >
<ImageView
android:id="@+id/headerbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/headerbar_small" />
<ImageView
android:id="@+id/skirrlogo"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"
android:src="@drawable/skirrwhite" />
<ImageView
android:id="@+id/skirrmenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:src="@drawable/slideropener" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/skirrlogo"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/skirrlogo"
android:text="@string/classses"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<ImageView
android:id="@+id/newclass"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/headerbar"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:src="@drawable/class_button_new" />
<ImageView
android:id="@+id/deletemenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/skirrlogo"
android:src="@drawable/menubutton_large" />
<ListView
android:id="@+id/displaydata"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/newclass" >
</ListView>
</RelativeLayout>
custom_class.xml与Customclass.xml相同,对吗??检查并确保。所以只需从
Customclass.xml
中删除您的android:background=“@drawable/back\u bg”
,一切正常。一个数据是什么意思?每页一个数据?ListView似乎只在一个页面中使用,并且有多行检查您的back_bg大小,我认为,back_bg大小很大…@AstralProjection,我现在添加了图像,如果我向下滚动,那么只有我能够看到其他数据,它不会加载与我的第一个数据完全相同的其他数据。一个数据占用了整个活动页面。@MdAbdulGafur,不,这不是问题…@InnocentKiller我同意Md,请删除背景,然后尝试告诉我们结果
<?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="wrap_content"
android:background="@drawable/back_bg" >
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/classname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
</LinearLayout>
/**
* Updating parsed JSON data into ListView
* */
ListAdapter adapter = new SimpleAdapter(
Classes_Ext_DB.this, productsList,
R.layout.custom_class, new String[] {
TAG_CLASSNAME, TAG_ID },
new int[] { R.id.classname });
mListView.setAdapter(adapter);