我有一個圖片庫,和畫廊有一個默認選擇中心,看圖片如何左選擇器庫android?
我不需要左側的空間,所以我需要一個左選擇,所看到的畫面:
這是我的代碼
final Gallery galay = (Gallery)findViewById(R.id.gallerylay);
galay.setAdapter(new layoutAdapter(this));
galay.setSpacing(50);
..................
public class layoutAdapter extends BaseAdapter {
private Context ctx;
public layoutAdapter(Context c) {
ctx = c;
}
@Override
public int getCount() {
return pics1.length;
}
@Override
public Object getItem(int arg0) {
return arg0;
}
@Override
public long getItemId(int arg0) {
return arg0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
// Declare Variables
TextView txtrank;
TextView txtcountry;
TextView txtpopulation;
TextView imgflag;
View itemView = (arg1 == null) ? View.inflate(ctx, R.layout.slide, null) :arg1;
Gallery.LayoutParams innerLP = new Gallery.LayoutParams(250, 350);
itemView.setLayoutParams(innerLP);
itemView.setBackgroundResource(R.drawable.cadre1);
txtrank=(TextView) itemView.findViewById(R.id.textView1);
txtrank.setText(pics1[arg0]);
return itemView;
}}
請問我該怎麼做?
具有u使用XML來實現這一目標 –