I need simple control for icon choosing on Android 2.2 and higher.
Gallery was a better solution for me, but it is deprecated and I have to use HorizontalScrollView
and ViewPager
instead.
But how to migrate easy? How to use this classes and controls in this case? I've try to find complete example for this subject, but I can't find it.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
There are various problems with touch handling and hardware acceleration in CommonsWare's linked workaround. A simpler and more elegant solution, in my opinion, is to specify a negative margin for the ViewPager:
I then specified this dimension in my
dimens.xml
:To compensate for overlapping pages, each page's content view has the opposite margin:
Again in
dimens.xml
:(Note that the
viewpager_margin_fix
dimension is half that of the absoluteviewpager_margin
dimension.)We implemented this in the Dutch newspaper app De Telegraaf Krant:
This gist from Dave Smith shows a way to use
ViewPager
to have visual results very similar to aGallery
:Quoting my blog post on the topic of showing multiple pages at a time in a
ViewPager
:You might also want to sift through this android-developers thread, where somebody pointed out an issue with this on newer Android versions. You need to disable hardware acceleration due to a bug in
ViewPager
.