我已经使用DevsmartLib-Android 创建了HorizontalListView
以下是HorizontalListView的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
tools:context="com.test.demo.HorizontalListViewActivity">
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ddd"
/>
</LinearLayout>这是适配器中的实现。我想不出如何多次放大这个HorizontalListView来得到想要的结果
private BaseAdapter mAdapter = new BaseAdapter() {
private View.OnClickListener mOnButtonClicked = new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(HorizontalListViewActivity.this, "Item Clicked"+v, Toast.LENGTH_SHORT).show();
}
};
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vv = LayoutInflater.from(parent.getContext()).inflate(R.layout.viewitem, null);
TextView title = (TextView) vv.findViewById(R.id.title);
Button button = (Button) vv.findViewById(R.id.clickbutton);
button.setOnClickListener(mOnButtonClicked);
title.setText(dataObjects[position]);
return vv;
}这是这个应用程序现在的样子。我正在尝试在listview中充气HorizontalListView。我该如何从这里继续呢?

发布于 2016-05-08 13:47:58
我不明白“如何多次放大这个HorizontalListView以获得想要的结果”,但也许你想在一个布局中放入多个HorizontalListView。
如果我的理解是正确的,这就是你的答案。
使用ScrollView扩展布局。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/listview1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ddd"
/>
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/listview2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ddd"
/>
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/listview3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ddd"
/>
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/listview4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ddd"
/>
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/listview5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ddd"
/>
</LinearLayout>
</ScrollView>
</RelativeLayout>https://stackoverflow.com/questions/36141115
复制相似问题