Michael K.
- Forum-Beiträge: 6
26.07.2011, 00:11:12 via Website
26.07.2011 00:11:12 via Website
Hi,
ich bin langsam am verzweifeln. Irgendwie komme ich überhaupt nicht vorwärts
Ich möchte eine erzeugte Liste in einen Parent einbetten. Also quasi etwas, wie:
<Text>
<Generierte Liste>
Bei mir kommt aber jedes mal nur die <Generierte Liste> heraus
Mein Code sieht aus wie folgt:
Mein "Parent"-Layout (menu_appointments_show) - HIER habe ich das <include>-Tag gesetzt, jedoch hat es keine Auswirkungen
Leider konnte ich den Code nicht einrücken.
Viele Grüße
Michi
ich bin langsam am verzweifeln. Irgendwie komme ich überhaupt nicht vorwärts
Ich möchte eine erzeugte Liste in einen Parent einbetten. Also quasi etwas, wie:
<Text>
<Generierte Liste>
Bei mir kommt aber jedes mal nur die <Generierte Liste> heraus
Mein Code sieht aus wie folgt:
Mein "Parent"-Layout (menu_appointments_show) - HIER habe ich das <include>-Tag gesetzt, jedoch hat es keine Auswirkungen
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 android:orientation="vertical"
5 android:layout_width="match_parent"
6 android:layout_height="match_parent">
7 <TextView
8 android:text="@string/t_menu_appointment_show_title"
9 android:id="@+id/t_menu_appointment_show_title"
10 android:layout_height="wrap_content"
11 android:layout_width="fill_parent"
12 android:gravity="center"
13 style="@style/title_1"/>
14 <include
15 android:layout_width="fill_parent"
16 layout="@layout/menu_appointments_show_list"/>
17</LinearLayout>
Das Layout der zu generierenden Liste (menu_appointments_show_list)2<LinearLayout
3 xmlns:android="http://schemas.android.com/apk/res/android"
4 android:orientation="vertical"
5 android:layout_width="match_parent"
6 android:layout_height="match_parent">
7 <TextView
8 android:text="@string/t_menu_appointment_show_title"
9 android:id="@+id/t_menu_appointment_show_title"
10 android:layout_height="wrap_content"
11 android:layout_width="fill_parent"
12 android:gravity="center"
13 style="@style/title_1"/>
14 <include
15 android:layout_width="fill_parent"
16 layout="@layout/menu_appointments_show_list"/>
17</LinearLayout>
1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="horizontal"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent">
6 <TextView
7 android:layout_width="wrap_content"
8 android:id="@+id/t_menu_appointments_show_id"
9 android:visibility="gone"
10 android:text="TextView"
11 android:layout_height="wrap_content"/>
12 <TextView
13 android:layout_width="wrap_content"
14 android:id="@+id/t_menu_appointments_show_date"
15 android:text="TextView"
16 android:layout_weight="1"
17 android:gravity="center"
18 android:layout_height="wrap_content"/>
19 <TextView
20 android:layout_width="wrap_content"
21 android:id="@+id/t_menu_appointments_show_time"
22 android:text="TextView"
23 android:layout_weight="1"
24 android:gravity="center"
25 android:layout_height="wrap_content"/>
26 <TextView
27 android:layout_width="wrap_content"
28 android:id="@+id/t_menu_appointments_show_patient_id"
29 android:visibility="gone"
30 android:text="TextView"
31 android:layout_height="wrap_content"/>
32 <TextView
33 android:layout_width="wrap_content"
34 android:id="@+id/t_menu_appointments_show_patient"
35 android:visibility="gone"
36 android:layout_weight="1"
37 android:layout_height="wrap_content"/>
38 <TextView
39 android:layout_width="wrap_content"
40 android:id="@+id/t_menu_appointments_show_doctor_id"
41 android:visibility="gone"
42 android:text="TextView"
43 android:layout_height="wrap_content"/>
44 <TextView
45 android:layout_width="wrap_content"
46 android:id="@+id/t_menu_appointments_show_doctor"
47 android:text="TextView"
48 android:layout_weight="1"
49 android:gravity="center"
50 android:layout_height="wrap_content"/>
51</LinearLayout>
Meine ListActivity:2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:orientation="horizontal"
4 android:layout_width="fill_parent"
5 android:layout_height="fill_parent">
6 <TextView
7 android:layout_width="wrap_content"
8 android:id="@+id/t_menu_appointments_show_id"
9 android:visibility="gone"
10 android:text="TextView"
11 android:layout_height="wrap_content"/>
12 <TextView
13 android:layout_width="wrap_content"
14 android:id="@+id/t_menu_appointments_show_date"
15 android:text="TextView"
16 android:layout_weight="1"
17 android:gravity="center"
18 android:layout_height="wrap_content"/>
19 <TextView
20 android:layout_width="wrap_content"
21 android:id="@+id/t_menu_appointments_show_time"
22 android:text="TextView"
23 android:layout_weight="1"
24 android:gravity="center"
25 android:layout_height="wrap_content"/>
26 <TextView
27 android:layout_width="wrap_content"
28 android:id="@+id/t_menu_appointments_show_patient_id"
29 android:visibility="gone"
30 android:text="TextView"
31 android:layout_height="wrap_content"/>
32 <TextView
33 android:layout_width="wrap_content"
34 android:id="@+id/t_menu_appointments_show_patient"
35 android:visibility="gone"
36 android:layout_weight="1"
37 android:layout_height="wrap_content"/>
38 <TextView
39 android:layout_width="wrap_content"
40 android:id="@+id/t_menu_appointments_show_doctor_id"
41 android:visibility="gone"
42 android:text="TextView"
43 android:layout_height="wrap_content"/>
44 <TextView
45 android:layout_width="wrap_content"
46 android:id="@+id/t_menu_appointments_show_doctor"
47 android:text="TextView"
48 android:layout_weight="1"
49 android:gravity="center"
50 android:layout_height="wrap_content"/>
51</LinearLayout>
1public class ShowAppointmentsActivity extends ListActivity {
2
3 private static final String TAG = new String(ShowAppointmentsActivity.class.getSimpleName());
4
5 @Override
6 public void onCreate(Bundle savedInstanceState) {
7 super.onCreate(savedInstanceState);
8 Log.d(TAG,"onCreate");
9 //LADE AUS DB
10 this.setListAdapter(new AppointmentsShowAdapter(this, response.getAppointments(),response.getDoctors()));
11 }
12//...
13}
Und zuletzt der Adapter:2
3 private static final String TAG = new String(ShowAppointmentsActivity.class.getSimpleName());
4
5 @Override
6 public void onCreate(Bundle savedInstanceState) {
7 super.onCreate(savedInstanceState);
8 Log.d(TAG,"onCreate");
9 //LADE AUS DB
10 this.setListAdapter(new AppointmentsShowAdapter(this, response.getAppointments(),response.getDoctors()));
11 }
12//...
13}
1package de.luebeck.uni.itm.mss.android.tablet.appointment;
2import java.text.SimpleDateFormat;
3import java.util.List;
4import java.util.Map;
5
6import android.app.Activity;
7import android.util.Log;
8import android.view.LayoutInflater;
9import android.view.View;
10import android.view.ViewGroup;
11import android.widget.ArrayAdapter;
12import android.widget.TextView;
13import de.luebeck.uni.itm.mss.android.tablet.R;
14import de.luebeck.uni.itm.mss.xo.appointment.response.XoAppointmentGetResponse;
15import de.luebeck.uni.itm.mss.xo.user.doctor.response.XoDoctorGetResponse;
16
17public class AppointmentsShowAdapter extends ArrayAdapter<XoAppointmentGetResponse> {
18
19 private final Activity context;
20 private final List<XoAppointmentGetResponse> appointments;
21 private final Map<Integer,XoDoctorGetResponse> doctors;
22
23 public AppointmentsShowAdapter( Activity context,
24 List<XoAppointmentGetResponse> appointments,
25 Map<Integer,XoDoctorGetResponse> doctors) {
26 super(context, R.layout.menu_appointments_show, appointments);
27 this.context = context;
28 this.appointments = appointments;
29 this.doctors = doctors;
30 }
31
32 @Override
33 public View getView(int position, View convertView, ViewGroup parent) {
34 LayoutInflater inflater = context.getLayoutInflater();
35 View rowView = inflater.inflate(R.layout.menu_appointments_show_list, null, true);
36 TextView idView = (TextView) rowView.findViewById(R.id.t_menu_appointments_show_id);
37 //DATEN FÜLLEN
38 return rowView;
39 }
40}
Kann mir da einer bitte helfen?2import java.text.SimpleDateFormat;
3import java.util.List;
4import java.util.Map;
5
6import android.app.Activity;
7import android.util.Log;
8import android.view.LayoutInflater;
9import android.view.View;
10import android.view.ViewGroup;
11import android.widget.ArrayAdapter;
12import android.widget.TextView;
13import de.luebeck.uni.itm.mss.android.tablet.R;
14import de.luebeck.uni.itm.mss.xo.appointment.response.XoAppointmentGetResponse;
15import de.luebeck.uni.itm.mss.xo.user.doctor.response.XoDoctorGetResponse;
16
17public class AppointmentsShowAdapter extends ArrayAdapter<XoAppointmentGetResponse> {
18
19 private final Activity context;
20 private final List<XoAppointmentGetResponse> appointments;
21 private final Map<Integer,XoDoctorGetResponse> doctors;
22
23 public AppointmentsShowAdapter( Activity context,
24 List<XoAppointmentGetResponse> appointments,
25 Map<Integer,XoDoctorGetResponse> doctors) {
26 super(context, R.layout.menu_appointments_show, appointments);
27 this.context = context;
28 this.appointments = appointments;
29 this.doctors = doctors;
30 }
31
32 @Override
33 public View getView(int position, View convertView, ViewGroup parent) {
34 LayoutInflater inflater = context.getLayoutInflater();
35 View rowView = inflater.inflate(R.layout.menu_appointments_show_list, null, true);
36 TextView idView = (TextView) rowView.findViewById(R.id.t_menu_appointments_show_id);
37 //DATEN FÜLLEN
38 return rowView;
39 }
40}
Leider konnte ich den Code nicht einrücken.
Viele Grüße
Michi
— geändert am 26.07.2011, 00:43:19
Empfohlener redaktioneller Inhalt
Mit Deiner Zustimmung wird hier ein externer Inhalt geladen.
Mit Klick auf den oben stehenden Button erklärst Du Dich damit einverstanden, dass Dir externe Inhalte angezeigt werden dürfen. Dabei können personenbezogene Daten an Drittanbieter übermittelt werden. Mehr Infos dazu findest Du in unserer Datenschutzerklärung.