I have a ListView with two types of custom views. It inflates
"icon_row" view if a drawable exists or a "text_row" if not.
I came up w/ custom views for icon_row & text_row & include them in
their XML like so :
//text_row.xml
<LinearLayout ....>
< com.test.android.ALS.text_row
...
app:text1="..."
app:textSize1=".."
>
/LinearLayout>
//icon_row.xml
<LinearLayout ...>
<com.test.android.ALS.icon_row
...
app:imgSrc="..."
>
/LinearLayout>
I have another main.xml that defines the ListView which is set to an
adpater.
In my adatper's getView (in separate class file), I will inflate:
if(convertView == null) {
if(<no drawable>) {
convertView = mInflater.inflate(R.layout.text_row. null);
} else {
convertView = mInflater.inflate(R.layout.icon_row,
null);
}
}
Both of icon_row, text_row have a root LinearLayout that seem to be
redundant. The row layouts can be directly attached ListView. This
may be a case for "merge".
To use merge, I need a ViewGroup in inflate & that ViewGroup should be
my ListView.
My question is how to obtain a reference to the ListView w/o making
the adapter as an inner class to the main activity.
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---