I am currently running into issues with my custom listview layout. I got what I thought would be the hardest part finished with the custom adapter. All the data is there it just doesn’t look the way it does in the XML. Both on a phone and emulator.
Example (Ignore the borders. The yellow is the row)
What the XML file looks like. 
What it is rendering as.

My XML file for the custom layout:
<?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="70dp"
android:maxHeight="30dp"
android:background="@color/yellow" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="30dp"
android:gravity="right"
android:text="1"
android:textColor="@color/red"
android:textStyle="bold"/>
<ImageView
android:id="@+id/imageView1"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/textView1"
android:src="@drawable/blankuser"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="3dp"
android:layout_toRightOf="@+id/imageView1"
android:text="username"
android:textColor="@color/black"
android:textSize="16dp"/>
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/imageView1"
android:text="Clout: "
android:textColor="@color/dgreen"
android:textSize="12dp"
android:textStyle="bold|italic"/>
<TextView
android:id="@+id/textView3"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView2"
android:layout_centerVertical="true"
android:ellipsize="end"
android:text="TextView"
android:textColor="@color/black"
android:textSize="10dp"/>
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/textView4"
android:text="TextView"
android:textColor="@color/dgreen"
android:textSize="12dp"
android:textStyle="bold|italic"/>
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="23dp"
android:text=">"
android:textStyle="bold"/>
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_toLeftOf="@+id/textView7"
android:text="score"
android:textColor="@color/red"
android:textSize="16dp"
android:textStyle="bold"/>
</RelativeLayout>
My getView for the adapter:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
LeaderView ldrView = null;
if(rowView == null)
{
LayoutInflater inflater = activity.getLayoutInflater();
rowView = inflater.inflate(R.layout.customlist, null);
ldrView = new LeaderView();
ldrView.username = (TextView) rowView.findViewById(R.id.textView2);
ldrView.hometown = (TextView) rowView.findViewById(R.id.textView3);
ldrView.score = (TextView) rowView.findViewById(R.id.textView6);
// ldrView.avatar = (ImageView) rowView.findViewById(R.id.imageView1);
ldrView.ranking = (TextView) rowView.findViewById(R.id.textView1);
ldrView.clout = (TextView) rowView.findViewById(R.id.textView5);
rowView.setTag(ldrView);
} else {
ldrView = (LeaderView) rowView.getTag();
}
LeaderList currentLeader = (LeaderList) leaders.get(position);
ldrView.username.setText(currentLeader.getUsername());
ldrView.hometown.setText(currentLeader.getHometown());
ldrView.score.setText(currentLeader.getScore());
ldrView.ranking.setText(currentLeader.getRanking());
ldrView.clout.setText(currentLeader.getClout());
return rowView;
}
Thanks in advanced!
EDIT:
Got it working. It was a bug with the picture or the package. I had to clean the package, delete R.java, and delete the imageView. After readding the imageView and building it looks like it should.
Turned out to be an issue with the
imageView. I deleted and re-added it to the XML and it’s working as desired. Thanks for the help and I hope this helps someone else.