卧式列表视图从GitHub不工作 [英] Horizontal Listview Not Working from github
问题描述
我使用的是GitHub的库,使位图的水平滚动视图,但是这不工作(ASLO尝试了textviews)。
I am using a GitHub library to make a horizontal scrollview of bitmaps but this is not working (aslo tried it for textviews).
在这个库的基本code我用<一个href=\"https://github.com/MeetMe/Android-HorizontalListView/blob/master/AndroidHorizontalListView/src/com/meetme/android/horizontallistview/HorizontalListView.java\"相对=nofollow>是这样的。
The basic code in this library I used is this.
这是我使用的定制Arrayadapter:
This is the custom Arrayadapter I am using:
public class CustomArrayAdapterForalbumart extends ArrayAdapter<AlbumArtclass> {
private LayoutInflater mInflater;
private Context mContext=null;
private List<AlbumArtclass> data=new Vector<AlbumArtclass>();
public CustomArrayAdapterForalbumart(Context context, List<AlbumArtclass> totalalbumarts) {
super(context, R.layout.custom_data_view, totalalbumarts);
this.mContext=context;
mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.data=totalalbumarts;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
Holder holder;
if(row==null)
{
LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
row = mInflater.inflate(R.layout.custom_data_view, parent,false);
holder= new Holder();
holder.abumartforeachclass=(ImageView) row.findViewById(R.id.Albumartforsonginpayeractivity);
row.setTag(holder);
}
else
{
holder=(Holder) row.getTag();
}
AlbumArtclass mrb =data.get(position);
holder.abumartforeachclass.setImageBitmap(mrb.getAlbumARt());
return row;
}
/** View holder for the views we need access to */
private static class Holder {
public ImageView abumartforeachclass;
}
}
这是Albumart类:
This is Albumart class:
public class AlbumArtclass {
private Bitmap Albumartforthis=null;
public AlbumArtclass(Bitmap backgroundColor) {
Albumartforthis = backgroundColor;
}
public Bitmap getAlbumARt() {
return Albumartforthis;
}
}
这是我使用的布局(我的XML的一部分):
This is the layout I used (part of my XML):
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.androidhive.musicplayer.HorizontalListView
android:id="@+id/HSVfoalbumarinplayeractivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</ScrollView>
custom_data_view.xml:
custom_data_view.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" >
<ImageView
android:id="@+id/Albumartforsonginpayeractivity"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
我歌厅问题是列表视图没有显示任何数据。
The problem I am geting is the listview is not showing any data.
public void setupp(){
adapterforalbumarts=new CustomArrayAdapterForalbumart(context, totalalbumarts);//totalalbumart contatins bitmaps
HSVforimageGallery.setAdapter(adapterforalbumarts);
}
列表视图是显示黑屏。
Listview is showing a black screen.
推荐答案
尝试使用机器人:fillViewport =真您的滚动视图中
try use android:fillViewport="true" inside your scroll view
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<com.androidhive.musicplayer.HorizontalListView
android:id="@+id/HSVfoalbumarinplayeractivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</ScrollView>
这篇关于卧式列表视图从GitHub不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!