搜索后从本地数据库获取数据。我得到了这个观点。
try{
DatabaseHandler db=new DatabaseHandler(getApplicationContext());
retailers=new ArrayList<HashMap<String, String>>();
String str=str_search[0];
retailers=db.getRetailers(str);
}catch(Exception e){
Log.d("Exception",e.toString());
}
// Keys used in Hashmap
String[] from = {"id","shop_name","address"};
// Ids of views in listview_layout
int[] to = {R.id.id,R.id.shopname,R.id.address};
// Instantiating an adapter to store each items
// R.layout.listview_layout defines the layout of each item
ListAdapter adapter = new SimpleAdapter(RetailersListActivity.this,retailers, R.layout.retailer_list_item, from, to);
return adapter;
这个问题与listview或某些coading问题有关
plz help !!!
答案 0 :(得分:0)
我认为在您的xml
文件中,您将ListView
设置在底部布局上方,因此请尝试按照以下方式设置xml布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
//here your search layout should be android:layout_alignParentTop="true"
<ListView
android:id="@+id/attendanceList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/your_search_layout"
android:layout_above="@+id/your_bottom_layout" >
</ListView>
//here your bottom layout should be android:layout_alignParentBottom="true"
</RelativeLayout>
希望这种情况可以帮助你...