I have been reading up on simple_list_item_2 and other standardized ways of displaying multi line text on a listview but none have given me what I want. As of now I am using a custom layout for the listview, but I lack the knowledge (after reading multiple articles) on how to customize each row in the listview to display it's own line of large text, tooltip (small text), and picture.
Here is the code I am using to initalize the listview and set the adapter
//List View
final String[] itemname = {
"More Rockets",
"Better Lasers",
"Super Shield",
"Super Defense"
};
final String[] itemtip = {
"+1 attack",
"+5 attack ",
"+1 defense",
"+5 defense"
};
final ListView upgradeList = (ListView) findViewById(R.id.upgradeListView);
upgradeList.setAdapter(new ArrayAdapter<String>(
this, R.layout.program_list,
R.id.Itemname, itemname));
program_list.xml
<?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="80dp"
android:background="@drawable/buttontemplate">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Item Name"
android:id="@+id/Itemname"
android:textSize="30sp"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/imageView"
android:layout_marginLeft="15sp" />
<ImageView
android:layout_width="30sp"
android:layout_height="30sp"
android:id="@+id/imageView"
android:src="@drawable/heart"
android:layout_marginLeft="20dp"
android:layout_alignBottom="@+id/Itemname"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Tooltip:"
android:id="@+id/toolTip"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/Itemname"
android:layout_marginLeft="20dp" />
</RelativeLayout>
Here was my idea for puting another line of text in the listview but it is not the right amount of arguments
upgradeList.setAdapter(new ArrayAdapter<String>(
this, R.layout.program_list,
R.id.Itemname, itemname, R.id.toolTip, itemtip));
Any help is very much appreciated! -Kelton