I currently try to design an UI which should look like this:
- Code: Select all
------------------------------------------
| 4 Static Buttons | <-- This should be visible every time
------------------------------------------
| image1 text1 of Item1 in list /|
| text2 of Item1 in list ||
|------------------------------------- ||
| image2 text1 of Item2 in list || <-- The ListView should be filled dynamically
| text2 of Item2 in list || and should be scrollable
|------------------------------------- ||
| image3 text1 of Item3 in list ||
| text2 of Item3 in list ||
|--------------------------------------||
| ||
| ||
| ||
| ||
| ||
| ||
| |
------------------------------------------
| 2 Static Buttons | <-- This should be visible every time too
------------------------------------------
What I want is a ListView which has four buttons at the top and two at the bottom. The buttons on the top switch to other views/activities and the buttons on the bottom switch to the next type of information.
The problem is that my ListView has the 4+2 buttons in every ListEntry (see the attached picture: files/1_826.png). For my app I used the EfficientAdapter-Example of the API and I have done the tutorials of plusminus (iconifiedText). I know where the reason is, but I don't know how to fix it.
Can anybody explain this to me how I manage it or has anybody a solution?
Greets,
emrah
JAVA-Code:
Using java Syntax Highlighting
- public class ListInformationActivity extends ListActivity {
- private static final String[] mTi = {"Location 1", "Location 2", "Location 3", "Location 4", "Location 5", "Location 6", "Location 7", "Location 8", "Location 9", "Location 10" };
- private static final String[] mLocations = {"Location 1", "Location 2", "Location 3", "Location 4", "Location 5", "Location 6", "Location 7", "Location 8", "Location 9", "Location 10" };
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setListAdapter(new ListInformationAdapter(this));
- }
- private static class ListInformationAdapter extends BaseAdapter {
- private LayoutInflater mInflater;
- public ListInformationAdapter(Context context) {
- mInflater = LayoutInflater.from(context);
- }
- @Override
- public int getCount() {
- return mTitles.length;
- }
- @Override
- public Object getItem(int position) {
- return position;
- }
- @Override
- public long getItemId(int position) {
- return position;
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- ViewHolder holder;
- if (convertView == null) {
- convertView = mInflater.inflate(R.layout.list_information, null);
- holder = new ViewHolder();
- holder.title = (TextView) convertView.findViewById(R.id.title);
- holder.location = (TextView) convertView.findViewById(R.id.location);
- convertView.setTag(holder);
- } else {
- holder = (ViewHolder) convertView.getTag();
- }
- holder.title.setText(mTi[position]);
- holder.location.setText(mLocations[position]);
- return convertView;
- }
- static class ViewHolder {
- TextView title;
- TextView location;
- }
- }/**/
- }
Parsed in 0.039 seconds, using GeSHi 1.0.8.4
XML-Layout:
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/view_a"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <LinearLayout
- android:orientation="horizontal"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:layout_gravity="center">
- <Button
- android:id="@+id/button_a"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/a_title">
- </Button>
- <Button
- android:id="@+id/button_l"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/l_title">
- </Button>
- <Button
- android:id="@+id/button_s"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/s_title">
- </Button>
- <Button
- android:id="@+id/button_n"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/n_title">
- </Button>
- </LinearLayout>
- <ListView android:id="@+id/android:list"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:drawSelectorOnTop="false" />
- <TextView android:id="@+id/title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
- <TextView android:id="@+id/location"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
- <LinearLayout
- android:orientation="horizontal"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:layout_gravity="center">
- <Button
- android:id="@+id/button_previous"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/previous">
- </Button>
- <Button
- android:id="@+id/button_next"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/next">
- </Button>
- </LinearLayout>
- </LinearLayout>
Parsed in 0.009 seconds, using GeSHi 1.0.8.4


Your hints were very helpful... 
