Is it possible to make a gridview that has instead of a grid of pictures, a grid of pictures with a small imagebutton below every one of them?
相关问题
- 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
Short answer: Yes. You can have an
ImageView
and anImageButton
in aGridView
.Long answer:
You will naturally have to create a custom
GridView
for that purpose.For example:
Create an XML which will hold the container
GridView
, say,grid.xml
:And, to define the contents of the
GridView
, create another XML layout which will hold theImageView
and theImageButton
. Say,grid_items.xml
:Finally, if you are familiar with the concept of custom
ListViews
, with a few modifications, you will be able to implement a customGridView
too. If you are not familiar with customListViews
orGridViews
, follow this tutorial to see how to create a customGridView
: http://www.coderzheaven.com/2012/02/29/custom-gridview-in-android-a-simple-example/. Or use this Google Search for more tutorials on the same.An important point here would be, if you need the
ImageButton's
to do a function when they are clicked, theonClickListener
will need to be setup in theAdapter
.GridView
shows a grid ofViews
. It can show anything that extendsView
class. It can show aLinearLayout
with anImageView
and anImageButton
inside it.