Java Android ScrollView按钮始终位于顶部
嗨,我有一个滚动视图,里面我有一个线性布局,里面我有一个按钮。我不知道当我滚动视图时,怎么能让这个按钮总是在顶部。现在当我滚动查看时,按钮消失了 我的代码:Java Android ScrollView按钮始终位于顶部,java,android,Java,Android,嗨,我有一个滚动视图,里面我有一个线性布局,里面我有一个按钮。我不知道当我滚动视图时,怎么能让这个按钮总是在顶部。现在当我滚动查看时,按钮消失了 我的代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" an
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:weightSum="1">
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:layout_marginTop="0dp">
<Button
android:id="@+id/cpic"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="1"
android:text="Zdjęcie" />
<Button
android:id="@+id/up"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="1"
android:text="Wyślij" />
</LinearLayout>
<ImageView
android:id="@+id/Imageprev"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_marginTop="58dp" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
我从您的问题中了解到,我认为您可以通过将按钮放在XML中滚动视图的外部来实现它,这将为您提供一个修复按钮
希望这能有所帮助。使用下面的
android:layout\u将线性布局移到滚动视图上方,并将滚动视图放在按钮布局下方
attribute@KrzysztofPokrywka:把你的按钮拿开,也就是说,它应该是@SaravInfern的直接孩子谢谢你的帮助!这可能是一个注释,请在回答时尝试添加代码示例我无法添加注释,因为我缺少代表…:(