I want a Gridview with image and EditText. I want to show image in fullscreen on click and select that Gridview item to delete on long click.But the GridView events OnItemLongClickListener() and OnItemClickListener() are not responding with EditText, though they work when Edittext android:focusable="false" is set. I have tried many different solutions but none of them are working. here is my code:
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<GridView
android:numColumns="2"
android:gravity="center"
android:columnWidth="100dp"
android:stretchMode="columnWidth"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/grid"
/>
</LinearLayout>
grid_single.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:orientation="vertical"
android:id="#+id/lin"
>
<ImageView
android:id="#+id/grid_image"
android:layout_width="50dp"
android:layout_height="50dp">
</ImageView>
<EditText
android:id="#+id/grid_text"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="15dp" >
</EditText>
</LinearLayout>
Main_activity.java
//import not included
public class MainActivity extends Activity {
GridView grid;
String[] web = {
"Google",
"Github",
"Instagram",
"Facebook",
} ;
int[] imageId = {
R.drawable.ic_launcher,
R.drawable.ic_launcher,
R.drawable.ic_launcher,
R.drawable.ic_launcher
};
private LayoutParams layoutParams;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
CustomGrid adapter = new CustomGrid(MainActivity.this, web, imageId);
grid=(GridView)findViewById(R.id.grid);
grid.setAdapter(adapter);
grid.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
#Override
public boolean onItemLongClick(AdapterView<?> parent,
View view, int position, long id) {
// TODO Auto-generated method stub
grid.setItemChecked(position, true);
View tv=(View) grid.getChildAt(position);
tv.setBackgroundColor(Color.LTGRAY);
return false;
}
});
grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent,
View view, int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, "You Clicked at " +web[+ position], Toast.LENGTH_SHORT).show();
}
});
}
}
CustomGrid.java
//import not included
public class CustomGrid extends BaseAdapter{
private Context mContext;
private final String[] web;
private final int[] Imageid;
public CustomGrid(Context c,String[] web,int[] Imageid ) {
mContext = c;
this.Imageid = Imageid;
this.web = web;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return web.length;
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View grid;
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
grid = new View(mContext);
grid = inflater.inflate(R.layout.grid_single, null);
EditText textView = (EditText) grid.findViewById(R.id.grid_text);
ImageView imageView = (ImageView)grid.findViewById(R.id.grid_image);
// Button b1=(Button)grid.findViewById(R.id.button1);
textView.setText(web[position]);
imageView.setImageResource(Imageid[position]);
} else {
grid = (View) convertView;
}
return grid;
}
}
Any help would be appreciated.. thanks in advance..
try adding these lines in your EditText
android:focusable="false"
android:focusableInTouchMode="false"
So finally solved the problem.
I used gesturelistener and detected motion.
Thank You.
Related
I am creating custom grid. Each row has 1 button and 2 textviews. I am trying to assign values/text to each programmatically. I am able to set text for both the text views but, findviewbyId for button returns null.
Grid is like:
<GridView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="auto_fit"
android:verticalSpacing="10dip"
android:horizontalSpacing="10dip"
android:stretchMode="columnWidth"
android:gravity="center"
android:background="#FFFFFF"
android:padding="5dip"
android:id="#+id/gvMYActivitySearch" />
Row layout is
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<Button
android:id="#+id/btnHistory"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:background="#drawable/button_background"
android:text="History"/>
<TextView
android:id="#+id/tvName"
android:layout_width="wrap_content"
android:layout_height="35dp" />
<TextView
android:id="#+id/tvContact"
android:layout_width="wrap_content"
android:layout_height="35dp" />
</LinearLayout>
Custom grid java file is like
public class CustomGrid extends BaseAdapter {
private Context mContext;
private final String[] names;
private final String[] Contact;
private final String[] ID;
public CustomGrid(Context c,String[] names,String[] Contact, String[] ID ) {
mContext = c;
this.Contact = Contact;
this.names = names;
this.ID = ID;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return names.length;
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View grid;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//grid = new View(mContext);
grid = inflater.inflate(R.layout.myactivity_singlerow, null);
} else {
grid = (View) convertView;
}
TextView tvName = (TextView) grid.findViewById(R.id.tvName);
TextView tvContact = (TextView) grid.findViewById(R.id.tvContact);
Button btnHistory = (Button) grid.findViewById(R.id.btnHistory);
tvName.setText(names[position]);
tvContact.setText(Contact[position]);
if(btnHistory!=null) {
btnHistory.setId(Integer.parseInt(ID[position]));
btnHistory.setOnClickListener(
new View.OnClickListener() {
#Override
public void onClick(View view) {
new MainActivity().testButton(view.getId());
}
}
);
}
return grid;
}
When I try to debug, I can see for the first time when position is '0', btnHistory is not null. But after that when position is 1, btnHistory is null.
What could possibly go wrong? When both the textviews are not null, why btnHistory is null?
Comment to improve your code:
callback somewhere outside your getView
I mean this:
public class CustomGrid extends BaseAdapter implements OnClickListener {
if(btnHistory!=null) {
btnHistory.setId(Integer.parseInt(ID[position]));
btnHistory.setTag((Integer)view.getId());
btnHistory.setOnClickListener(this);
}
public void onClick(View v) {
new MainActivity().testButton(v.getTag());
}
}
I want to set images in grid view with multiple columns. Images can be vary in columns.How can i achieve it. Thanks in advance
Images in GridView
create activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<GridView
android:id="#+id/gridView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:numColumns="3" >
</GridView>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25dp"
android:textStyle="bold"
android:text=" Computer Languages..." />
</RelativeLayout>][1]][1]
Create MainActivity.
public class MainActivity extends Activity {
GridView gv;
Context context;
ArrayList prgmName;
public static String [] prgmNameList={"Let Us C","c++","JAVA","Jsp","Microsoft .Net","Android","PHP","Jquery","JavaScript"};
public static int [] prgmImages={R.drawable.images,R.drawable.images1,R.drawable.images2,R.drawable.images3,R.drawable.images4,R.drawable.images5,R.drawable.images6,R.drawable.images7,R.drawable.images8};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gv=(GridView) findViewById(R.id.gridView1);
gv.setAdapter(new CustomAdapter(this, prgmNameList,prgmImages));
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Create a folder by name drawable in res directory. Insert the images into drawable folder by name as below.
public static int [] prgmImages={R.drawable.images,R.drawable.images1,R.drawable.images2,R.drawable.images3,R.drawable.images4,R.drawable.images5,R.drawable.images6,R.drawable.images7,R.drawable.images8};
Create the layout as programlist.xml.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_gravity="center"
android:layout_width="88dp"
android:layout_height="88dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/textView1"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:text="TextView" />
</LinearLayout>
Create Customclass ie CustomAdapter.
public class CustomAdapter extends BaseAdapter{
String [] result;
Context context;
int [] imageId;
private static LayoutInflater inflater=null;
public CustomAdapter(MainActivity mainActivity, String[] prgmNameList, int[] prgmImages) {
// TODO Auto-generated constructor stub
result=prgmNameList;
context=mainActivity;
imageId=prgmImages;
inflater = ( LayoutInflater )context.
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return result.length;
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
public class Holder
{
TextView tv;
ImageView img;
}
#Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
Holder holder=new Holder();
View rowView;
rowView = inflater.inflate(R.layout.program_list, null);
holder.tv=(TextView) rowView.findViewById(R.id.textView1);
holder.img=(ImageView) rowView.findViewById(R.id.imageView1);
holder.tv.setText(result[position]);
holder.img.setImageResource(imageId[position]);
rowView.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(context, "You Clicked "+result[position], Toast.LENGTH_LONG).show();
}
});
return rowView;
}
}
You will get the Output like..
I'm trying to create a custom gridview inside a fragment that should look something like this:
http://imgur.com/6fEFYTN
So I created a FragmentLayout that contains the image and the label:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="#+id/grid_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
/>
<TextView
android:id="#+id/grid_label"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_marginTop="175dp"
android:background="#drawable/label"
android:gravity="center"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:textStyle="bold" />
The adapter that manages the FragmentLayout looks like this:
public class CustomGridAdapter extends BaseAdapter{
private Context mContext;
private final String[] label;
private final int[] imgId;
public CustomGridAdapter(Context c,String[] label,int[] imgId ) {
mContext = c;
this.imgId = imgId;
this.label = label;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return 0;
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View grid;
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
grid = new View(mContext);
grid = inflater.inflate(R.layout.image_button_layout, null);
TextView textView = (TextView) grid.findViewById(R.id.grid_label);
ImageView imageView = (ImageView)grid.findViewById(R.id.grid_image);
textView.setText(label[position]);
imageView.setImageResource(imgId[position]);
} else {
grid = (View) convertView;
}
return grid;
}
}
The fragment grid is as follows:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<GridView
android:numColumns="auto_fit"
android:gravity="center"
android:columnWidth="90dp"
android:stretchMode="columnWidth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/form_grid"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
/>
</LinearLayout>
I'm creating this from the onCreateView method, I'm using onclickListener so the images work as buttons and display a toast when pressed:
#Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_layout_softdrinks, container, false);
GridView grid = (GridView) rootView.findViewById(R.id.form_grid);
CustomGridAdapter adapter = new CustomGridAdapter(rootView.getContext(), label, imgId); //label and imgId are arrays containing strings and int respectively
grid.setAdapter(adapter);
grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(inflater.getContext(), "You Clicked at " +label[+ position], Toast.LENGTH_SHORT).show();
}
});
return rootView;
}
The problem is that when I run the code, the screen is blank, so the gridview is not being populated.
Any advice on this?
First of all you will need to provide a payload in imgId array and label array.
Then your grid view won't inflate as well because you are returning 0 in your getCount method!
To inflate your layout replace in your getCount method
Return 0;
With
Return imgId.length;
The getCount method tells the base adapter how much images or strings(..data) you have in your array which you want to inflate in the grid view. If you returning 0, base adapter thinks that there are 0 data to inflate.
I have created a gridview and added a checkbox in it.On clicking on checkbox grid view item which are image view with textview get selected.
But I want to check the checkbox on tap of grid view item.
This my MainActivity
public class MainActivity extends Activity {
GridView gridview;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gridview = (GridView) findViewById(R.id.mainGrid);
gridview.setAdapter(new ImageAdapter(MainActivity.this));
gridview.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View v, int position,
long id) {
// TODO Auto-generated method stub
//
//
ImageAdapter.holder.ItemCheck.setId(position);
ImageAdapter.holder.ItemCheck.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
//ImageAdapter.holder.ItemCheck.setChecked(true);
Toast.makeText(MainActivity.this, "Itemclicked" ,Toast.LENGTH_LONG).show();
}
});
Toast.makeText(
MainActivity.this, "Itemclicked", Toast.LENGTH_SHORT).show();
}
});
};
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
This is my AdapterClass
public class ImageAdapter extends BaseAdapter{
private Context mContext;
public static ViewHolder holder;
public ImageAdapter(Context c) {
mContext = c;
}
#Override
public int getCount() {
return mThumbIds.length;
}
#Override
public Object getItem(int position) {
return null;
}
#Override
public long getItemId(int position) {
return 0;
}
public boolean areAllItemsEnabled(){
return true;
}
#Override
public boolean isEnabled(int position) {
// TODO Auto-generated method stub
return true;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
//ViewHolder holder;
View myView = convertView;
ImageView imageView;
if (convertView == null) { // if it's not recycled, initialize some attributes
//Inflate the layout
holder = new ViewHolder();
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(8, 8,8, 8);
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
myView = inflater.inflate(R.layout.grid_items_ontap, null);
holder.ItemCheck = (CheckBox) myView.findViewById(R.id.itemCheckBox);
myView.setTag(holder);
}else{
holder = (ViewHolder) myView.getTag();
}
// holder.ItemCheck.setId(position);
// holder.ItemCheck.setOnClickListener(new OnClickListener() {
//
// public void onClick(View v) {
// // TODO Auto-generated method stub
// Toast.makeText(mContext, "Itemclicked" ,Toast.LENGTH_LONG).show();
// }
// });
// Add The Image!!!
ImageView iv = (ImageView)myView.findViewById(R.id.grid_item_image_OnTap);
iv.setImageResource(mThumbIds[position]);
// Add The Text!!!
TextView tv = (TextView)myView.findViewById(R.id.grid_item_text_onTap);
tv.setText(names[position] );
holder.ItemCheck.setChecked(isEmpty());
holder.id = position;
return myView;
}
public class ViewHolder {
public CheckBox ItemCheck;
int id;
}
private String[] names={"ab","cd","ef","gh","ij","kl","mn","","","","","","",""};
private Integer[] mThumbIds = {
R.drawable.car, R.drawable.car,
R.drawable.car, R.drawable.car,
R.drawable.car,R.drawable.car,R.drawable.car,R.drawable.car, R.drawable.car,
R.drawable.car, R.drawable.car,
R.drawable.car,R.drawable.car,R.drawable.car
};
}
Gridview.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/gridlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<GridView
android:id="#+id/mainGrid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:horizontalSpacing="0dp"
android:numColumns="3"
android:clickable="true"
android:stretchMode="columnWidth"
android:verticalSpacing="0dp" >
</GridView>
</LinearLayout>
griditems.xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/GridItem"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:orientation="vertical" >
<ImageView
android:id="#+id/grid_item_image_OnTap"
android:layout_width="100dp"
android:layout_height="100dp" >
</ImageView>
<TextView
android:id="#+id/grid_item_text_onTap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:text="TextView"
android:textColor="#android:color/black" >
</TextView>
<CheckBox
android:id="#+id/itemCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:button="#drawable/custom_checkbox"
android:checked="true"
android:visibility="visible"
android:focusable="true" />
</RelativeLayout>
Please suggest me.I m new to android and I got stuck here.
Thanks
I want to check the checkbox on tap of grid view item.
you can do it by using second parameter of onItemClick method as:
#Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
CheckedTextView check = (CheckedTextView) view;
check.setChecked(!check.isChecked());
boolean click = !check.isChecked();
check.setChecked(click);
if (click) {
//write what you want whenever click a checkbox
}
}
I have to create UI of an application as shelf which holds magazines. I am using customize grid view, with grid element consisting of thumbnail of magazine having shelf as background image.
shelf.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<GridView
android:id="#+id/gridView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="4" >
</GridView>
</LinearLayout>
item.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/grid">
<ImageView
android:id="#+id/imageView1"
android:layout_width="70dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="41dp"
android:src="#drawable/book1" />
</RelativeLayout>
LibraryActivity.java
public class LibraryActivity extends Activity {
GridView grid = null;
ArrayList<Integer> image = new ArrayList<Integer>();
ImageView thumbnail;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.shelf);
image.add(R.drawable.book1);
image.add(R.drawable.book2);
image.add(R.drawable.book3);
image.add(R.drawable.book4);
System.out.println("before adapter");
grid = (GridView) findViewById(R.id.gridView1);
CustomAdapter adapter = new CustomAdapter(this, R.layout.item);
grid.setAdapter(adapter);
}
public class CustomAdapter extends BaseAdapter {
Context mContext = null;
int mitem = 0;
LayoutInflater mInflater = null;
public CustomAdapter(Context context, int item) {
this.mContext = context;
this.mitem = item;
this.mInflater = (LayoutInflater) context
.getSystemService(LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return image.size();
}
#Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
System.out.println("****CHECKING 2**********");
convertView = mInflater.inflate(mitem, null);
System.out.println("****CHECKING 3**********");
thumbnail = (ImageView) convertView
.findViewById(R.id.imageView1);
System.out.println("****CHECKING 3**********");
}
thumbnail.setImageResource(image.get(position));
return convertView;
}
}
}
But using this code the shelf with magazine is only being displayed. I want to display empty shelf to occupy whole screen of device. How can i do that??
Is there any alternate way to implement the shelf??
There's a great project called Shelves made by Romain Guy from Google. You should check it out.