android - 如何使对象位于 ScrollView 的底部

标签 android android-layout

我有一个带有 Root View 的 ScrollView ,它是线性布局

在LinearLayout的底部有一个按钮

我想让它随着 ScrollView 向上滚动,但是当 View 第一次出现在屏幕上时 我希望按钮位于 View 的底部,但它不是

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/default_side_margin"
        android:layout_marginRight="@dimen/default_side_margin"
        android:orientation="vertical" >


        <include
            android:id="@+id/details"
            layout="@layout/layout_details"
             />

        <include
            android:layout_gravity="bottom"
            layout="@layout/layout_btn_next" />
    </LinearLayout>
</ScrollView>

第一个包含的布局只占屏幕的一半左右

我希望按钮随着布局向上滚动,但要远离布局细节以位于屏幕底部

最佳答案

没有完全理解你的问题,但你应该在 ScrollView 上尝试 android:fillViewport=true,看这里: http://www.curious-creature.org/2010/08/15/scrollviews-handy-trick/

关于android - 如何使对象位于 ScrollView 的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24186534/

相关文章:

android - 如何使用 isInEditMode() 在编辑器中查看带有自定义 View 的布局

android - ParseException 仅适用于 Galaxy Nexus

Android EditText边框背景色

android - 每个 Activity 都必须有一个布局吗?

Android:如何将 CheckBox 文本重心设置为整个控件的中心?

android - 抽屉没有覆盖操作栏

android - 线性布局上的图像重叠

android - 为什么我的 TextInputLayout 的 outLine 框没有出现?

java - 将图像字节数组作为 json 从 android 应用程序传递到 c# restful 服务

android - ExpandableListView 和滚动