hi,
i am trying to create customized expandable listview.
i have almost completed except one thing describe as follows.
*first-of-all what i have :*
*
*
<https://lh4.googleusercontent.com/-4mGspOzQX2M/UGrQ95KifAI/AAAAAAAAAEY/Tjta1vKzHeg/s1600/i+have.png>
i am able to create this kind of list displayed @ attachment *"i have.png"*
*
*
*Problem :*
*
*
<https://lh6.googleusercontent.com/-68_3BlhxPm8/UGrRJ9DYVSI/AAAAAAAAAEg/iFUrmcwaHEQ/s1600/i+want.jpg>
*
*
but i want this kind of list displayed @ attachment *"i want.png"*
*
*
as you seen that, i want to change the color of the child record, means
change the status indication Red to Green and Green to Red
how can i do this ??
b'cos as far as my knowledge is concern we have to set textview style @ the
xml design time, and directly that textview id is mentioning
in SimpleExpandableListAdapter().
this is my code
*1.* All xml file is available in attachment (with drawable/layout_nearby
file)
*2. TaskLog.java*
*
*
public class TaskLog extends ExpandableListActivity
{
private static final String NAME = "NAME";
private static final String CHILDNAME = "CHILDNAME";
private static final String TOTALVISIT = "TOTALVISIT";
private static final String STATUS = "STATUS";
private static final String REMAININGVISIT = "REMAININGVISIT";
private ExpandableListAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.task_log);
List<Map<String, String>> groupData = new ArrayList<Map<String,
String>>();
List<List<Map<String, String>>> childData = new
ArrayList<List<Map<String, String>>>();
for (int i = 0; i < 2; i++)
{
Map<String, String> curGroupMap = new HashMap<String, String>();
groupData.add(curGroupMap);
curGroupMap.put(NAME, "Group " + i);
//curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even"
: "This group is odd");
List<Map<String, String>> children = new ArrayList<Map<String,
String>>();
for (int j = 0; j < 3; j++)
{
Map<String, String> curChildMap = new HashMap<String,
String>();
children.add(curChildMap);
curChildMap.put(CHILDNAME, "Child Name" + j);
curChildMap.put(TOTALVISIT, "Child Total Visit" + j);
curChildMap.put(STATUS, "Child Status " + j);
curChildMap.put(REMAININGVISIT, "Child Remaining Visit " +
j);
}
childData.add(children);
}
mAdapter = new SimpleExpandableListAdapter(
this,
groupData, R.layout.head,
new String[] { NAME },
new int[] { R.id.headrow },
childData,
R.layout.new_child,
new String[] { CHILDNAME, TOTALVISIT, STATUS,
REMAININGVISIT },
new int[] { R.id.child_name, R.id.child_totalVisit,
R.id.child_status, R.id.child_remainingVisit } );
setListAdapter(mAdapter);
}
@Override
public void onBackPressed()
{
Log.d("Emp","TaskLog");
finish();
}
}
Thank you.
*
*
*
*
*
*
*
*
*
*
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/headrow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:paddingBottom="5dip"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff"
android:textStyle="bold" />
</LinearLayout><?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="wrap_content"
android:background="@drawable/layout_nearby" >
<TextView
android:id="@+id/child_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
<ImageView
android:id="@+id/child_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dip"
android:layout_marginRight="3dip"
android:src="@drawable/right_arrow" />
<TextView
android:id="@+id/child_totalVisit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/child_arrow"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
<TextView
android:id="@+id/child_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/child_name"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" />
<TextView
android:id="@+id/child_remainingVisit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/child_status"
android:layout_alignBottom="@+id/child_status"
android:layout_alignRight="@+id/child_totalVisit"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" />
</RelativeLayout><?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient android:startColor="#d6d5d5"
android:endColor="#ececec"
android:angle="90"
android:type="linear"/>
</shape><?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:background="#ffffff" >
<ExpandableListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/topContainer"
android:layout_marginTop="10dip"
android:groupIndicator="@null" >
</ExpandableListView>
</RelativeLayout>