0
Ich habe alle Ansichten in einem ScrollView
.Ansicht scrollt nach oben, wenn der Spinner Wert geändert wird
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="www.sample.com.Settings">
<LinearLayout
android:orientation="vertical"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/basic_settings"
android:background="@color/colorPrimaryDark"
android:textColor="#fff"
android:id="@+id/settings_header_1"
android:padding="5dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</LinearLayout>
.
.
.
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="5dp">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/job"
android:padding="5dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Spinner
android:background="@drawable/textbox"
android:padding="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/jobs">
</Spinner>
</LinearLayout>
</LinearLayout>
</ScrollView>
Wenn der Wert von I den Wert des Drehfelds ändert, wird die Ansicht nach oben verschoben. aber warum? und wie kann man das vermeiden?