我做了一個佈局,在頂部有一個listView和其他元素,當我打開這個佈局時,屏幕將重點放在linearLayout上,它就像它在linearLayout上設置的滾動,它有一個如何將滾動設置到佈局的頂部?Iniciolice佈局頂部位置
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/White"
android:orientation="vertical" >
<include
\t \t layout= "@layout/tool_bar"
\t \t android:layout_height= "wrap_content"
\t \t android:layout_width= "match_parent"/>
<ScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
\t android:layout_height="fill_parent"> \t
\t
<LinearLayout
android:layout_width="match_parent"
\t android:layout_height="fill_parent"
\t android:orientation="vertical">
\t
<TextView
\t android:layout_width= "fill_parent"
\t android:layout_height= "wrap_content"
\t android:text= "NOTIFICATIONS"
\t android:textSize= "10dp"
\t android:layout_margin= "10dp"
\t
\t />
\t <View
\t android:layout_widt = "fill_parent"
\t android:layout_height= "1dp"
\t android:background= "@android:color/darker_gray"/>
<RelativeLayout
\t android:layout_width= "fill_parent"
\t android:layout_height= "wrap_content" \t
\t android:paddingRight= "12dp">
\t <TextView
\t android:id= "@+id/general_notifications"
\t \t style= "@style/bold"
\t \t android:paddingLeft= "20dp"
\t \t android:paddingTop= "20dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content"
\t \t android:text= "@string/Notifications" \t
\t \t android:layout_alignParentStart= "true"
\t \t android:textColor= "@color/date_left"
\t \t android:textSize= "18dp"/> \t
\t <TextView \t
\t \t style= "@style/light"
\t \t android:paddingStart= "20dp"
\t \t android:paddingBottom= "20dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content"
\t \t android:text= "@string/global_notifications_text" \t
\t \t android:layout_below= "@+id/general_notifications"
\t \t android:textColor= "@color/date_left"/>
\t
\t \t <Switch
\t \t android:id= "@+id/global_notification_switch" \t \t
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content"
\t \t android:layout_alignParentEnd= "true" \t \t
\t \t android:padding= "18dp"/>
\t </RelativeLayout>
<View \t \t
\t android:layout_width= "fill_parent"
\t android:layout_height= "1dp"
\t android:background= "@android:color/darker_gray"/>
<RelativeLayout
\t android:layout_width= "fill_parent"
\t android:layout_height= "wrap_content" \t
\t android:paddingRight= "12dp"
\t android:onClick= "selectWifi">
\t <TextView
\t android:id= "@+id/wi_fi"
\t \t style= "@style/bold"
\t \t android:paddingStart= "20dp"
\t \t android:paddingTop= "20dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content"
\t \t android:text= "@string/WiFi" \t
\t \t android:layout_alignParentStart= "true"
\t \t android:textColor= "@color/date_left"
\t \t android:textSize= "18dp"/> \t
\t <TextView \t
\t android:id= "@+id/wifi_name"
\t \t style= "@style/light"
\t \t android:paddingTop= "20dp"
\t \t android:paddingStart= "5dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content" \t \t \t
\t \t android:layout_toEndOf= "@+id/wi_fi"
\t \t android:layout_alignBaseline= "@+id/wi_fi"
\t \t android:textColor= "@color/date_left"/>
\t
\t <TextView \t
\t android:id= "@+id/wifi_explaining_text"
\t \t style= "@style/light"
\t \t android:paddingStart= "20dp"
\t \t android:paddingBottom= "20dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content"
\t \t android:text= "@string/wifi_settings" \t
\t \t android:layout_below= "@+id/wi_fi"
\t \t android:textColor= "@color/date_left"/>
\t </RelativeLayout>
<View \t \t
\t android:layout_width= "fill_parent"
\t android:layout_height= "1dp"
\t android:background= "@android:color/darker_gray"/>
<RelativeLayout
\t android:layout_width= "fill_parent"
\t android:layout_height= "wrap_content" \t
\t android:paddingRight= "12dp"
\t android:onClick= "setTime">
\t <TextView
\t android:id= "@+id/notifications_hours"
\t \t style= "@style/bold"
\t \t android:paddingStart= "20dp"
\t \t android:paddingTop= "20dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content"
\t \t android:text= "@string/not_hours" \t
\t \t android:layout_alignParentStart= "true"
\t \t android:textColor= "@color/date_left"
\t \t android:textSize= "18dp"/>
\t
\t <TextView \t
\t android:id= "@+id/hours_data"
\t \t style= "@style/light"
\t \t android:paddingTop= "20dp"
\t \t android:paddingStart= "5dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content" \t \t \t
\t \t android:layout_toEndOf= "@+id/notifications_hours"
\t \t android:layout_alignBaseline= "@+id/notifications_hours"
\t \t android:textColor= "@color/date_left"/>
\t
\t <TextView \t
\t \t style= "@style/light"
\t \t android:paddingStart= "20dp"
\t \t android:paddingBottom= "20dp"
\t \t android:layout_width= "wrap_content"
\t \t android:layout_height= "wrap_content"
\t \t android:text= "@string/not_hours_text" \t
\t \t android:layout_below= "@+id/notifications_hours"
\t \t android:textColor= "@color/date_left"/>
\t </RelativeLayout>
<View \t \t
\t android:layout_width= "fill_parent"
\t android:layout_height= "1dp"
\t android:background= "@android:color/darker_gray"/>
<TextView
\t android:layout_width="fill_parent"
\t android:layout_height="wrap_content"
\t android:text="APPS"
\t android:textSize="10dp"
\t android:layout_margin="10dp"/>
\t <View
\t android:layout_width="fill_parent"
\t android:layout_height="1dp"
\t android:background="@android:color/darker_gray"/>
\t
<ListView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="305dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
請分享XML佈局,第一 – LaurentY
對不起,它的存在,現在 – GusDev