74259

android how to make gridview item corner round

Question:

I will add a image to show it. <a href="https://drive.google.com/file/d/0B-dRDlHZAgYbVG5Ca1l2MTZseHc/edit?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B-dRDlHZAgYbVG5Ca1l2MTZseHc/edit?usp=sharing</a> you can see the detail in the image.

Answer1:

For each grid item use the background below :-<br /> (save the below code in drawable folder)

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp"> <shape android:shape="rectangle"> <solid android:color="@color/black_transparent"/> <corners android:bottomRightRadius="12dp" android:bottomLeftRadius="12dp" android:topLeftRadius="12dp" android:topRightRadius="12dp"/> </shape> </item> </layer-list>

Answer2:

make grid_item_corner.xml in drawable folder.

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp"> <shape android:shape="rectangle"> <solid android:color="@android:color/transparent" /> <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp" /> </shape> </item> </layer-list>

and set grid <strong>single layout</strong> item

android:background="@drawable/grid_item_corner"

I hope this will help you.

Note: Above background property is about grid view single item layout, not to gridview.

Recommend

  • Change Design Support Navigation View Header Title Programmatically
  • Recreate Apple Watch fitness tracker ‘progress’ bar - gradient on CAShapeLayer stroke
  • Drag and reorder - UICollectionview with sections
  • Thrust filter by key value
  • Loop animation drawable
  • Gray line inside cardview :)?
  • Express JS Display Data By ID
  • write text on image and show it to a imageview
  • Unable to resolve Static method?
  • Wrapping text in spinner android
  • How to resolve permission denied maybe missing internet permission?
  • C#: Import/Export Settings into/from a File
  • Access variable of ScriptContext using Nashorn JavaScript Engine (Java 8)
  • How Lists (specifically, RecyclerView with CardViews) in Android work
  • Code in Job's Script Block after Start-Process Does not Execute
  • How can I set a binding to a Combox in a UserControl?
  • Stop Bash Script if Hive Fails
  • AJAX Html Editor Extender upload image appearing blank
  • Paperclip, set path outside of rails root folder
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Proper folder structure for lots of source files
  • Benchmarking RAM performance - UWP and C#
  • Load html files in TinyMce
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Turn off referential integrity in Derby? is it possible?
  • How can I remove ASP.NET Designer.cs files?
  • Add sale price programmatically to product variations
  • Append folder name and increment by 1 using batch script
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal
  • How do I use LINQ to get all the Items that have a particular SubItem?