【问题标题】:how Left selector gallery android?android的左选择器画廊如何?
【发布时间】:2013-11-27 08:59:13
【问题描述】:

我有一个图库,图库有一个默认的选择器中心,看图

我不需要左边的空间,因此我需要一个左边的选择器,如图所示:

这是我的代码

 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;
    }}

请问我该怎么做?

【问题讨论】:

  • 让你使用 xml 来实现这个

标签: android cursor gallery selecteditem


【解决方案1】:

您是否在 XMl 中实现了画廊视图?如果是则设置

android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
android:columnWidth="70dp"
android:stretchMode="columnWidth"

【讨论】:

猜你喜欢
  • 2011-03-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-22
  • 1970-01-01
  • 2020-05-20
  • 2017-06-21
  • 1970-01-01
相关资源
最近更新 更多