How to expand the height of a row in listview on clicking it?

You should use custom adapter and in getView (bindView in the case of CursorAdapter) change LayoutParams to "match_parent" if position == clickedPosition or to "your default value" otherwise static class ViewHolder { TextView text; } private final LayoutParams MATCH_PARENT = new LayoutParams(LayoutParams. MATCH_PARENT, LayoutParams. WRAP_CONTENT); private final LayoutParams WRAP_CONTENT = new LayoutParams(LayoutParams.

WRAP_CONTENT, LayoutParams. WRAP_CONTENT); public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if(convertView == null) { holder = new ViewHolder(); convertView = mLayoutInflater. Inflate(R.layout.

My_layout, parent, false); holder. Text = (TextView)convertView. FindViewById(R.id.

Text); convertView. SetTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.text. SetText("SomeText")); if(position == selectedPosition) { convertView.

SetLayoutParams(MATCH_PARENT); } else { convertView. SetLayoutParams(WRAP_CONTENT); } return convertView; }.

Thanks for the suggestions , please put some code if possible – Prachur Aug 3 at 10:15 I've added getView of custom adapter. You must pass selectedPosition in it. – Maxim Aug 3 at 11:04 Thanks for the code maxim , can you also tell me some way to use another xml on click of a row in listview to display data in that particular row – Prachur Aug 3 at 11:30 If I understand you properly you should use mLayoutInflater.

Inflate(R.layout. Another_layout, parent, false); in getView with particular layout param. But in this case you have to inflate view every time getView is called (instead of usin convertView).

It is possible but will use more memory. – Maxim Aug 3 at 12:05 hi maxim I have added my code please look at it and tell me how to achieve inflating another layout on click of an item – Prachur Aug 3 at 12:13.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions