我希望在图库视图中显示图像,使用它在android中的位置来聚焦到特定图像
SimpleAdapter adapter1 = new SimpleAdapter(ShowingGalleryActivity.this,arrList1, R.layout.showinggalleryview, new String[]{"image","company"},
new int[]{R.id.showinggalleryview_goggle_iv,R.id.showinggalleryview_companyname_tv}
);
mGallery.setDescendantFocusability(position);
mGallery.setAdapter(adapter1);
答案 0 :(得分:1)
在Gallery中尝试setselection(position)方法。请参阅http://developer.android.com/reference/android/widget/Gallery.html
答案 1 :(得分:0)
您是否尝试阅读文档?
public void setSelection (int position)
Since: API Level 1
Sets the currently selected item. To support accessibility subclasses that override this method must invoke the overriden super method first.
Parameters
position Index (starting at 0) of the data item to be selected.