vendredi 22 mai 2015

Setting height of a gridView item as double of width

the width of the grid item will change when the screen size changes. I need to set the height of the grid item as double of the width of the grid item. that is , if the width of grid item=25dp height must be 50dp.

This is getView funciton of my Adapter

@Override
public View getView(int position, View convertView, ViewGroup parent) {

TextView no=new TextView(context);
no.setText(position+"");
no.setLayoutParams(new FrameLayout.LayoutParams(android.widget.FrameLayout.LayoutParams.FILL_PARENT,150));// I need to set double of width instead of 150

}

Aucun commentaire:

Enregistrer un commentaire