1、xml布局
2、自定义MyGallery
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
public class MyGallery extends LinearLayout {
private Context mContext;
private BaseAdapter adapter;
private AdapterView.OnItemClickListener onItemClickListener;
public MyGallery(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
mContext = context;
setOrientation(HORIZONTAL);
}
public MyGallery(Context context) {
super(context);
// TODO Auto-generated constructor stub
mContext = context;
setOrientation(HORIZONTAL);
}
public void setAdapter(BaseAdapter adapter){
this.adapter = adapter;
for(int i=0;i
原创内容转载请保留出处GEEK笔记(https://www.geekapp.cn/)。