gpt4 book ai didi

FragmentActivity 中没有图库的 Android Image Slider

转载 作者:行者123 更新时间:2023-11-29 01:57:41 26 4
gpt4 key购买 nike

我正在尝试创建一个 Tabed 应用程序,其中一个选项卡最多可容纳 25-30 张图像。我希望图像能够滑动到下一个/上一个并且没有画廊。

我一直在四处搜索,试图找到某种 slider 示例,但只找到了很多使用 Gallery 的示例,女巫似乎也在 ICS 及更高版本中被弃用。

The preferred look

到目前为止我得到的是实际 fragment :

public class ImageTab extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.image_layout, container, false);
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}

}

如果有人能指出我正确的方向,将不胜感激。

最好的,亨里克

最佳答案

@Hiny: I'm trying to create a Tabed application where one tab will hold up to 25-30 images.

将 FragmentActivity 与选项卡主机或操作栏选项卡导航一起使用,其中一个选项卡包含带有 ViewPager 的 fragment .

mViewPager.setAdapter(new MyImagesPagerAdapter(getChildFragmentManager()));

@Hiny: I want does images to be able to swipe to the next/prev and not having a gallery.

ViewPager 将为您提供此功能,并且很容易添加页面指示器。

Quote from the Android Developer site: Nested Fragments

"For example, if you use ViewPager to create fragments that swipe left and right and consume a majority of the screen space, you can now insert fragments into each fragment page."

它从 Android 1.6 开始支持 Android 支持库。

@Hiny: If anyone could point me in the right direction, it would be mostly appreciated.

有关代码示例,请查看 https://github.com/marsucsb/nested-fragments

关于FragmentActivity 中没有图库的 Android Image Slider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14302056/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com