J'ai essayé de faire défiler ListView vers le haut lorsque l'élément d'événement est plus que l'espace de ListView, mais il échoue. Je voudrais savoir si je peux faire défiler le ListView sans ajouter d'écouteur. Je vous remercie.ListView ne peut pas faire défiler
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:clickable="true"
android:focusableInTouchMode="true"
tools:context="com.example.ssycorpapp.SecondActivity" >
<TabHost
android:id="@+id/tabhost2"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/events"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<SearchView
android:id="@+id/search"
android:queryHint="@string/hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</SearchView>
<RelativeLayout
android:id="@+id/titleBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:layout_below="@id/search" >
<TextView
android:id="@+id/resultName"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="@string/event"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/resultDate"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/resultTime"
android:layout_toStartOf="@+id/resultTime"
android:text="@string/eventDate"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@id/resultTime"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:text="@string/eventTime"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<ListView
android:id="@+id/event_list"
android:scrollbars="vertical"
android:fastScrollEnabled="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_below="@id/titleBar"
android:layout_above="@+id/DelAll" />
<Button
android:id="@+id/DelAll"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginBottom="10dp"
android:layout_alignParentBottom="true"
android:text="@string/DelAll" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/set"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/EventName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/event" />
<EditText
android:id="@+id/eveName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text" >
</EditText>
<TextView
android:id="@+id/EventDate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/eventDate" />
<DatePicker
android:id="@+id/datePicker1"
android:layout_width="match_parent"
android:layout_height="158dp" />
<TextView
android:id="@+id/EventTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/eventTime" />
<TimePicker
android:id="@+id/timePicker1"
android:layout_width="match_parent"
android:layout_height="109dp" />
<Button
android:id="@+id/Tim"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Set" />
</LinearLayout>
</ScrollView>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
Ne pas utiliser ListView et ScrollView à la fois – Nabin
@Nabin Même si ListView et ScrollView se trouvent dans des onglets différents? – shisushi