Wie kann ich den Anfang (vertikal) einer Liste im ListFragment festlegen?

  • Antworten:2
Matthias S.
  • Forum-Beiträge: 2

03.05.2014, 20:53:42 via Website

Hallo allerseits,

über die folgende Klasse erzeuge ich eine Liste:
public class MainMenuListFragment extends ListFragment implements ActionBar.TabListener { ...... }

In dieser Klasse gibt es auch eine lokale Klasse mit einem ListAdapter.

Was mich interessiert ist, über welchen Befehl man festlegen kann ab wo - vertikal - diese Liste beginnt (siehe Hardcopy).

Wer kann mir helfen?

LG Matthias

image

Antworten
Pascal P.
  • Admin
  • Forum-Beiträge: 11.286

04.05.2014, 11:28:21 via Website

Hast du dazu auch ein Layout?
Vlt ist dort etwas falsch

LG Pascal //It's not a bug, it's a feature. :) ;)

Antworten
Matthias S.
  • Forum-Beiträge: 2

04.05.2014, 15:34:04 via Website

Das Layout kommt ja vom ListFragment. Die einzelne Zeile habe ich natürlich angepasst (siehe Listing).

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=".....schemas.android.com/apk/res/android"
xmlns:tools=".....schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:baselineAligned="false"
android:divider="?android:attr/dividerHorizontal"
android:orientation="horizontal"
android:showDividers="middle" >

<ImageView
    android:id="@+id/menu_list_item_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical|center_horizontal"
    android:contentDescription="@string/menu_image" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="5dp" >
</TextView>

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/menu_list_item_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge" >
    </TextView>

    <TextView
        android:id="@+id/menu_list_item_subtext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </TextView>

</LinearLayout>

</LinearLayout>

Antworten