I have a ListView and I wanted to place a small rectangle on the side of each item. To do so I made the following rendered layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="3dp">
<View
android:layout_width="5dp"
android:layout_height="fill_parent"
android:id="#+id/item_color_image"
android:background="#color/wallet_holo_blue_light"
android:layout_marginRight="3dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_icon_image"
android:src="#drawable/m"
android:layout_toRightOf="#+id/item_color_image"
android:layout_centerVertical="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Business Name"
android:id="#+id/item_title_text"
android:layout_toRightOf="#+id/item_icon_image"
android:layout_marginLeft="3dp"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_alignTop="#+id/item_icon_image" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Distance"
android:id="#+id/item_distance_text"
android:layout_alignLeft="#+id/item_title_text"
android:layout_alignBottom="#+id/item_icon_image"
android:layout_marginBottom="-10dp" />
</RelativeLayout>
When I inflate this layout in a frame, it works just fine.....BUT when I inflate it inside a ListView I get this:
The rectangle's height is being ignored to match the container's height.
I inflate it using this code:
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View itemView = convertView;
if (itemView == null) {
itemView = inflater.inflate(R.layout.business_item_view, parent, false);
}
Business currentBusiness = businesses.get(position);
ImageView icon = (ImageView) itemView.findViewById(R.id.item_icon_image);
icon.setImageBitmap(currentBusiness.getIcon());
TextView name = (TextView) itemView.findViewById(R.id.item_title_text);
name.setText(currentBusiness.getName());
TextView distance = (TextView) itemView.findViewById(R.id.item_distance_text);
distance.setText("2 Km"); // TODO: Calculate distance
return itemView;
}
How can I fix this? Thanks!!
Having your root item for a ListView row be match_parent for height doesn't make sense; each item would fill the ListView. I expect that's automatically being changed to wrap_content somewhere.
And RelativeLayouts don't support children with match_parent for height if the RelativeLayout's height is wrap_content. It works with LinearLayouts, so you should look into switching to that. Source: combining wrap_content on parent and fill_parent on child
Related
This is my code for how each row looks.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="120dp"
android:id="#+id/recipe_container"
android:layout_margin="12dp"
android:background="#f1f1f1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/recipe_name_text_view"
android:layout_width="match_parent"
android:layout_height="60dp"
android:gravity="center_vertical"
android:textSize="32sp"
android:text="DUMMY TEXT"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/recipe_time_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DUMMY TEXT"/>
<TextView
android:id="#+id/recipe_difficulty_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DUMMY TEXT"/>
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/recipe_thumbnail_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/sladice"/>
</LinearLayout>
As you can see I have margin set, if I check preview it is also shown.
I populated with inflate this listivew.
This is activity_sladice.xml.
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/recipe_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.android.recepti.Sladice"
android:background="#color/colorPrimary">
</ListView>
Now each row is together, there is no spacing between left, right, bottom , top.
If I add margin or padding to listview it only works on the entire list, not on each row.
How to do it? I know I can add divider between each row but I also want spacing right and left.
This is getView method from custom adapter.
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View recipeView = convertView;
ReceptThumbnail recipe = getItem(position);
// Inflate view if to be inflated
if (recipeView == null) {
recipeView = LayoutInflater.from(getContext()).inflate(R.layout.recipe_item, parent, false);
}
TextView recipeName = (TextView) recipeView.findViewById(R.id.recipe_name_text_view);
recipeName.setText(recipe.getName());
TextView recipeTime = (TextView) recipeView.findViewById(R.id.recipe_time_text_view);
recipeTime.setText(recipe.getTime());
TextView recipeDifficulty = (TextView) recipeView.findViewById(R.id.recipe_difficulty_text_view);
recipeDifficulty.setText(recipe.getDifficulty());
ImageView recipeImage = (ImageView) recipeView.findViewById(R.id.recipe_thumbnail_image_view);
recipeImage.setImageResource(recipe.getImageResourceID());
}
If you want to add margins to the ListView, add margns to the listview.
If you want to add margins to the items, add margins to the items.
It is simple.
However, I suggest you to use ConstraintLAyout. And RecyclerView instead of ListView.
Try using padding in the LinearLayout, and create another LinearLayout as a child of the original, and move the background attribute to it.
try setting margin programmatically in getView method using below method.
public static void setMarginLeft(View v, int left) {
ViewGroup.MarginLayoutParams params =
(ViewGroup.MarginLayoutParams)v.getLayoutParams();
params.setMargins(left, params.topMargin,
params.rightMargin, params.bottomMargin);
}
I just need a way to show default picture on all imageview ( see below ) used in a listview.
This layout is used by an adapter, so no setContentView function is called on this layout. I think this is causing the problem ( the default images doesn't appear ). How can I fix it ?
The image defaultpic.png is in the drawable folder and is 100x100px.
My code:
<?xml version="1.0" encoding="utf-8"?>
<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:paddingLeft="0dp"
android:paddingRight="0dp"
tools:context=".MainActivity"
android:background="#222222"
android:paddingTop="2dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/profile_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Title"
android:textColor="#fcdb8c"
android:background="#222222"
android:textStyle="normal"
android:textSize="15sp"
android:layout_alignParentTop="true"
android:lines="1"
android:scrollHorizontally="true"
android:ellipsize="end"
android:paddingRight="40dp"
android:paddingLeft="2dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/profile"
android:scaleType = "fitXY"
android:src="#drawable/defaultpic"
android:background="#151515"
android:padding="1dp" />
</RelativeLayout>
#Override
public View getView(View convertView, ViewGroup parent) {
RelativeLayout profileLay = (RelativeLayout)profileInf.inflate
(R.layout.profile_layout, parent, false);
TextView profileView = (TextView)profileLay.findViewById(R.id.profile_name);
ImageView coverView = (ImageView)profileLay.findViewById(R.id.profile);
profileView.setText(currProfile.getName());
Drawable img = Drawable.createFromPath(currProfile.getCover());
coverView.setImageDrawable(img);
return profileLay;
}
As k3b said:
your generated layout for the listviewitem has the image
therefore you do not see the default picture.
the way to correct this is to add an if statement.
ImageView coverView = (ImageView)profileLay.findViewById(R.id.profile);
if (Drawable.createFromPath(currProfile.getCover()) == null) {
Drawable img = Drawable.createFromPath(currProfile.getCover());
coverView.setImageDrawable(img);
}
This will cause it to only load the profile cover if it isn't null, but if it is then the default profile image will be used.
your generated layout for the listviewitem has the image
<RelativeLayout...>
<ImageView android:id="#+id/profile" android:src="#drawable/defaultpic" ... />
</RelativeLayout>
and when the listviewitem is created you immediately overwrite the picture in the imageview
#Override
public View getView(View convertView, ViewGroup parent) {
...
ImageView coverView = (ImageView)profileLay.findViewById(R.id.profile);
Drawable img = Drawable.createFromPath(currProfile.getCover());
coverView.setImageDrawable(img);
...
therefor you do not see the default picture
I am putting this LinearLayout inside RelativeLayout.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
android:gravity="center">
<ImageView
android:layout_width="30dp"
android:layout_height="23dp"
android:src="#drawable/big_tick" />
</LinearLayout>
What I am trying to do is - to show which item has been chosen. I set LinearLayout's height and width match_parent. It is only matching parent(RelativeLayout)'s width, not height.
This is what I have intended to do:
This is what I am getting:
LinearLayout is not taking whole height of its parent.
There are 2 reasons, why I am using Relative layout as parent:
The LinearLayout should be in upside(should cover) book information with 40% black color
To show this symbol on the top of book
The whole XML looks like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal">
<LinearLayout
android:id="#+id/llBook"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="11dp"
android:paddingRight="2dp"
android:paddingTop="8dp">
<ImageView
android:id="#+id/ivCover"
android:layout_width="95dp"
android:layout_height="146dp" />
<TextView
android:id="#+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="#232425"
android:textSize="12sp" />
<TextView
android:id="#+id/tvAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="#848586"
android:textSize="10sp" />
</LinearLayout>
<ImageView
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignRight="#id/llBook"
android:layout_marginRight="6dp"
android:background="#drawable/shape_round_book_status"
android:padding="8dp"
android:src="#drawable/icon_new" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
android:gravity="center">
<ImageView
android:layout_width="30dp"
android:layout_height="23dp"
android:src="#drawable/big_tick" />
</LinearLayout>
</RelativeLayout>
I am using this RelativeLayout in BaseAdapter class using which I am filling GridView with items.
public class LibraryAdapter extends BaseAdapter {
Context context;
RealmResults<RBook> rBooks;
LayoutInflater inflater;
public LibraryAdapter(Context context, RealmResults<RBook> rBooks) {
this.context = context;
this.rBooks = rBooks;
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
return rBooks.size();
}
#Override
public Object getItem(int position) {
return rBooks.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
RBook rBook = (RBook) getItem(position);
View view = convertView;
if(view == null) {
// new row is needed to inflate new row
view = inflater.inflate(R.layout.listitem_library_book, parent, false);
}
Bitmap bitmap = BitmapFactory.decodeByteArray(rBook.getCover() , 0, rBook.getCover().length);
ImageView ivCover = (ImageView) view.findViewById(R.id.ivCover);
ivCover.setImageBitmap(bitmap);
TextView tvTitle = (TextView) view.findViewById(R.id.tvTitle);
tvTitle.setText(rBook.getTitle());
TextView tvAuthor = (TextView) view.findViewById(R.id.tvAuthor);
tvAuthor.setText(rBook.getAuthor());
return view;
}
}
EDIT:
Try1: as cj1098 suggested I have changed child LinearLayout to RelativeLayout. Unfortunately, no effect
Try2: as challenger suggested, I have used this inside my child LinearLayout, but effect was like this:
Try3: as codeMagic suggested, I have changed child LinearLayout's
gravity="center"
to ImageView's
layout_gravity="center"
In result, LinearLayout is not taking whole height.
So my question is how make child LinearLayout match parent RelativeLayout's height?
Try to add this to the LinearLayout:
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
Any way use can use this without even using the LinearLayout (with fixing the size of the drawable "big_tick" ):
<ImageView
android:layout_width="30dp"
android:background="#66000000"
android:layout_height="23dp"
android:src="#drawable/big_tick" />
I think that using this layout by itself is fine. It is the fact that you are putting it into a ListView is causing some sort a havoc.
However, you can force the overlay to align itself bottom and top with the book layout:
android:layout_alignBottom="#id/llBook"
android:layout_alignTop="#id/llBook"
After that maybe you still have a few margins to fix, but the two lines above will make the overlay be as big as the book layout.
it is taking the full height of its parent. Get rid of the padding on your child linear layout. Then if that doesn't work. Switch your linearLayout to a relativeLayout. (It's better anyway) another limitation is the actual images you are using. Do they have differing heights?
Remove the LinearLayout totally, use the imageview with src 'tick' as a direct child of the Relative layout with:
andriod:centerInParent=true
and then add View with the desired background transparency that has
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
I wish to add an ImageView inside a ListView. I would like the image to fill the layout without distorsion (basically, fill the height and adapt its width).
This is what I get now:
I have put a grey background to the ImageView to make it easier to see. In red, it's the size I wish to get.
Here is my code:
Project_form.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/name_project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:padding="3dp"
android:layout_alignParentLeft="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25dp" >
</TextView>
<Button
android:id="#+id/button_project"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_custom"
android:layout_centerVertical="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_alignParentRight="true"
android:padding="3dp"
android:text=" details "
android:textSize="20dp"
android:visibility="invisible" />
<ImageView
android:id="#+id/imagesstep"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="#color/grey"
android:adjustViewBounds="false"
android:layout_centerVertical="true"
android:padding="3dp"
android:layout_alignParentRight="true"
android:visibility="invisible" />
</RelativeLayout>
method getView() of my Adapter :
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row==null) {
LayoutInflater inflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.project_form, parent, false);
}
TextView text = (TextView) row.findViewById(R.id.name_project);
text.setText(this.objects[position].getName());
int IDImage=this.objects[position].getIDImage();
int IDPlay = this.objects[position].getIDPlay();
text.setCompoundDrawablesWithIntrinsicBounds(IDImage, 0, 0, 0);
text.setCompoundDrawablePadding(7);
ImageView image = (ImageView)
row.findViewById(R.id.imagesstep);
image.setVisibility(View.VISIBLE);
image.setImageResource(IDPlay);
if (position == selectedPosition) {
row.setBackgroundColor(Color.parseColor("#8000ff00"));
}
else {
row.setBackgroundColor(Color.TRANSPARENT);
}
return row;
}
I tried to play with different parameters such as ScaleType, android:adjustViewBounds and layout_width but the height of my image never changed. I also tried to do it programatically (something like image.setMinHeight(parent.getHeight()) but it failed too.
Could anyone point me out what is going wrong?
Many thanks
Try changing the RelativeLayout of the layout_height to fill_parent
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<TextView ... />
<Button .. />
<ImageView ... />
</RelativeLayout>
Alternatively you could set the minHeight attribute of the ImageView to ?android:attr/listPreferredItemHeight
<ImageView
...
android:minHeight="?android:attr/listPreferredItemHeight" />
Remove the padding from your imageview
I am trying to create a list item layout with 4 items. It is very similar to the example here with some key differences:
the RelativeLayout layout_height may be larger than listPreferredItemHeight
the image is a CheckBox
there are three TextViews
The top and middle TextViews could have visibility set to GONE
What I would like is: If _label is gone, then _message and _definition should be evenly weighted in the layout. If _label and _message are gone, _definition should be centered. I have tried several variations of height, width, gravity, layout_gravity and I even tried to solve this with a LinearLayout (both as the whole layout and just to contain the vertical text). The only way I can get this to work is if I set layout_height to listPreferredItemHeight, but then only two of the text views fit.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight">
<CheckBox android:id="#+id/alarm_list_item_able"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="True"
android:layout_alignParentLeft="True"
android:layout_alignParentBottom="True"
android:layout_centerVertical="True"
android:focusable="false"
android:layout_marginRight="6dp"
android:onClick="onClick"
/>
<TextView android:id="#+id/alarm_list_item_label"
android:text="Label place holder"
android:singleLine="True"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/alarm_list_item_able"
android:layout_alignParentTop="True"
android:gravity="center_vertical"
/>
<TextView android:id="#+id/alarm_list_item_message"
android:text="Message place holder"
android:singleLine="True"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/alarm_list_item_label"
android:layout_toRightOf="#id/alarm_list_item_able"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
/>
<TextView android:id="#+id/alarm_list_item_location"
android:singleLine="True"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#id/alarm_list_item_message"
android:layout_toRightOf="#id/alarm_list_item_able"
android:layout_marginBottom="5dp"
android:layout_alignWithParentIfMissing="true"
android:layout_alignParentRight="true"
android:paddingBottom="5dp"
android:text="(0.000, 0.000) 0m"
android:gravity="center_vertical"
/>
</RelativeLayout>
Adapter getView Code using the xml from blessenm's answer
#Override
public View getView(int position, View convertView, ViewGroup parent){
Log.d(Global.TAG,"Position "+position);
View newView;
if (convertView != null )
newView = convertView;
else {
LayoutInflater layout = LayoutInflater.from(MyActivity.this);
newView = layout.inflate(R.layout.alarm_list_item, null);
}
String tmp1 = "Place Holder Label"
TextView label = (TextView)newView.findViewById(R.id.alarm_list_item_label);
LayoutParams l = label.getLayoutParams();
if (tmp1.matches("^\\s*$")){
label.setLayoutParams(new LinearLayout.LayoutParams(l.width,l.height,0f));
} else {
label.setLayoutParams(new LinearLayout.LayoutParams(l.width,l.height,1f));
}
label.setText(tmp1)
String tmp2 = "Place Holder Message"
TextView message = (TextView)newView.findViewById(R.id.alarm_list_item_message);
l = message.getLayoutParams();
if (tmp2.matches("^\\s*$")){
message.setLayoutParams(new LinearLayout.LayoutParams(l.width,l.height,0f));
} else {
message.setLayoutParams(new LinearLayout.LayoutParams(l.width,l.height,1f));
}
message.setText(tmp2);
TextView location = (TextView)newView.findViewById(R.id.alarm_list_item_location);
location.setText("location");
return newView;
}
Layout_gravity will only work inside a linear layout. When you want all your textviews to take even height, put them in a linearlayout with vertical orientation and give weight as 1 for all the textviews. So now all of them will take equal heights.
When you need to hide the textviews, just set their layout_weight to 0, now the remaining textview will take the full available space. And if you give the textview gravity="center", the text will be centered both vertically and horizontally.
Edit: The xml and getView method
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<CheckBox android:id="#+id/alarm_list_item_able"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:layout_marginRight="6dp"
android:onClick="onClick"
android:layout_centerVertical="true"/>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/alarm_list_item_able"
android:orientation="vertical"
android:layout_centerVertical="true">
<TextView android:id="#+id/alarm_list_item_label"
android:text="Label place holder"
android:singleLine="True"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView android:id="#+id/alarm_list_item_message"
android:text="Message place holder"
android:singleLine="True"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/alarm_list_item_able"
android:layout_below="#id/alarm_list_item_label"/>
<TextView android:id="#+id/alarm_list_item_location"
android:singleLine="True"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="(0.000, 0.000) 0m"
android:layout_toRightOf="#id/alarm_list_item_able"
android:layout_below="#id/alarm_list_item_message"/>
</LinearLayout>
</RelativeLayout>
The getview method
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if(convertView == null){
convertView = inflater.inflate(R.layout.list, null);
holder = new ViewHolder();
holder.label = (TextView)convertView.findViewById(
R.id.alarm_list_item_label);
holder.msg = (TextView)convertView.findViewById(
R.id.alarm_list_item_message);
holder.loc = (TextView)convertView.findViewById(
R.id.alarm_list_item_location);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
if(holder != null){
if(data.get(position).mLabel.equals("")){
LinearLayout.LayoutParams labelLp = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT,0);
if(!data.get(position).mMsg.equals("")) {
holder.label.setLayoutParams(labelLp);
holder.msg.setText(data.get(position).mMsg);
holder.loc.setText(data.get(position).mLoc);
} else {
holder.label.setLayoutParams(labelLp);
holder.msg.setLayoutParams(labelLp);
holder.loc.setText(data.get(position).mLoc);
}
} else {
holder.label.setText(data.get(position).mLabel);
holder.msg.setText(data.get(position).mMsg);
holder.loc.setText(data.get(position).mLoc);
}
}
return convertView;
}