相关疑难解决方法(0)

如何在Gallery Widget中停止滚动?

我将一些图像加载到图库中.现在我可以滚动但是一旦开始滚动滚动就不会停止.我希望画廊只是滚动到下一个图像,然后停止,直到用户再次执行滚动手势.

这是我的代码

import android.widget.ImageView;
import android.widget.Toast;
 import android.widget.AdapterView.OnItemClickListener;

public class GalleryExample extends Activity {

private Gallery gallery;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

     gallery = (Gallery) findViewById(R.id.examplegallery);
     gallery.setAdapter(new AddImgAdp(this));

     gallery.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView parent, View v, int position, long id) {

            Toast.makeText(GalleryExample.this, "Position=" + position, Toast.LENGTH_SHORT).show();
        }
    });

}

public class AddImgAdp extends BaseAdapter {
    int GalItemBg;
    private Context cont;


    private Integer[] Imgid = {
            R.drawable.a_1, R.drawable.a_2, R.drawable.a_3, R.drawable.a_4, R.drawable.a_5, R.drawable.a_6, R.drawable.a_7
    };

    public AddImgAdp(Context c) …
Run Code Online (Sandbox Code Playgroud)

android scroll gallery android-widget

29
推荐指数
3
解决办法
2万
查看次数

标签 统计

android ×1

android-widget ×1

gallery ×1

scroll ×1