Buttons werden statt einmal, für jedes Listen Element wiederholt angezeigt

  • 2 Antworten
  • Letztes Antwortdatum
X

xben89

Neues Mitglied
0
Hallo zusammen,

der Titel beschreibt meine vorliegende Problematik. Meine xml sieht folgendermaßen aus:
Code:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content" android:orientation="vertical">

  <HorizontalScrollView 
        android:id="@+id/my_scrollview"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:scrollbars="none" 
                >
              
 <LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:id="@+id/LinearLayout01" android:layout_height="wrap_content">

            <Button android:text="@string/home" android:drawableTop="@drawable/back_home" android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/repoHome"></Button>

            <Button android:text="@string/back" android:drawableTop="@drawable/back_icon" android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/repoBack"></Button>

            <Button android:text="@string/refresh" android:drawableTop="@drawable/refresh_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/repoRefresh"></Button>

        </LinearLayout>

</HorizontalScrollView>

  <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:id="@+id/linearLayout1" android:layout_height="fill_parent">

      <ImageView android:id="@+id/img" android:layout_width="wrap_content" android:layout_margin="5px" android:layout_height="wrap_content"></ImageView>

      <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:id="@+id/linearLayout2" android:layout_height="wrap_content">

          <TextView android:textSize="16sp" android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/childrenFolderTitle" android:text="FolderName"></TextView>

          <TextView android:textSize="10sp" android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/author" android:text="Author"></TextView>
      </LinearLayout>
  </LinearLayout>

</LinearLayout>

mein simpleadapter aufruf sieht folgendermaßen aus:
Code:
	adapter = new SimpleAdapter(this, ServiceDocumentFolder.getDataForView(
				entry, idFolder, idDocument), R.layout.children_folder,

		new String[] { "title", "author", "img" },

		new int[] { R.id.childrenFolderTitle, R.id.author, R.id.img });

Ich vermute das Problem ist ,dass die Buttons im selben Layout sind und so jedes mal neu aufgerufen werden. Aber ich weiß nicht, wie ich das lösen soll?

Gruß,
Benny
 
Wenn die obere XML dein Layout für die "Rows" darstellt, dann ist es recht logisch, dass sie jedesmal erscheinen? :)
Wenn du sie nur einmal haben willst, dann musst du die Buttons in der XML deklarieren, in der deine Liste (ListView!) enthalten ist.
 
ia stimmt..ich habs jetzt dort eingefügt, wo meine listview ist. Aber das Problem ist jetzt dass es so aussieht als würde meine listview alle überdecken..ich seh die buttons überhaupt nicht. Woran liegt das?

Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   >
      
   

<HorizontalScrollView 
        android:id="@+id/my_scrollview"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:scrollbars="none" 
                >

            <LinearLayout android:id="@+id/my_layout"
                    android:layout_height="fill_parent"
                    android:orientation="horizontal"
                    android:layout_width="wrap_content" 
                    >

 
            <Button android:text="@string/home"
             android:drawableTop="@drawable/back_home"
              android:layout_width="wrap_content"
                android:layout_height="wrap_content"
               android:id="@+id/repoHome"
                android:textSize="8sp" 
                 android:layout_marginRight="3dip"/>
                                
               
            <Button android:text="@string/back" 
            android:drawableTop="@drawable/back_icon"
             android:layout_width="wrap_content"
    android:layout_height="wrap_content"
              android:id="@+id/repoBack"
                android:textSize="8sp" 
               android:layout_marginRight="3dip"/>
              
            <Button android:text="@string/refresh"
             android:drawableTop="@drawable/refresh_icon" 
             android:layout_width="wrap_content"
              android:layout_height="wrap_content" 
              android:id="@+id/repoRefresh"
                android:textSize="8sp" 
               android:layout_marginRight="3dip"/>
       
       
       
        </LinearLayout>
        </HorizontalScrollView>
       

 <LinearLayout android:orientation="vertical"
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:id="@+id/listing"
                >


       <ListView
                    android:id="@+id/android:list"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    />
      
</LinearLayout>
 </LinearLayout>
 
Zuletzt bearbeitet:
Zurück
Oben Unten