我正在使用两个具有相同适配器的 HorizontalListView。但是只有一个 HorizontalListView 是可见的,我不知道我做错了什么。
我的活动 onCreate 方法:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.books_library);
ScienceBooks = (HorizontalListView) findViewById(R.id.ScienceBooks);
FictionBooks = (HorizontalListView) findViewById(R.id.FictionBooks);
adapter = new BookAdapter(BooksLibrary.this, 1, images);
adapter1 = new BookAdapter(BooksLibrary.this, 1, images);
ScienceBooks.setAdapter(adapter);
FictionBooks.setAdapter(adapter1);
}
book_library.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" >
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/ScienceBooks"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/FictionBooks"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>