繁体   English   中英

如何在Android中将图库聚焦到特定位置?

[英]how to focus gallery to particular postion in android?

我想在图库视图中显示图像,想要使用其在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);

尝试使用Gallery中的setselection(position)方法。 请参阅http://developer.android.com/reference/android/widget/Gallery.html

您是否尝试阅读文档?

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.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM