Android : Stroke disappear on one side after setting layout params in Android

on Saturday, September 13, 2014


I have set layout params to my grid in Android, and due to this, a stroke from one side disappear.


This is my code :



if (convertView == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
convertView = inflater.inflate(R.layout.gridview_cell, parent, false);

WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();

int imgWidth = display.getWidth() / 2;
int imgHeight = (int) (imgWidth * 1.5f);

ViewGroup.LayoutParams lp = convertView.getLayoutParams();
lp.width = imgWidth;
lp.height = imgHeight;
convertView.setLayoutParams(lp);

holder = new ViewHolder();
holder.day = (TextView) convertView.findViewById(R.id.dayDateTextView);
holder.image = (ImageView) convertView.findViewById(R.id.dayImage);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}


And this is image showing the result : enter image description here


I have tried changing layout params values, but it didn't worked. Thanks.


0 comments:

Post a Comment