如何将画廊聚焦到android中的特定位置?

发布于 2024-12-28 05:19:25 字数 447 浏览 2 评论 0原文

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

I want display images in gallery view it want to focus to paticular image using its position in 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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

随遇而安 2025-01-04 05:19:25

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

Try the setselection(position) method in the Gallery. Refer http://developer.android.com/reference/android/widget/Gallery.html

夏九 2025-01-04 05:19:25

您尝试阅读文档吗?

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.

Did you try reading the documentation?

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文