,可以使用布局属性来实现。具体步骤如下:
示例代码如下:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- 其他视图 -->
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="按钮"
android:layout_gravity="bottom" />
</LinearLayout>
</ScrollView>
在上述代码中,垂直线性布局中的占位视图使用了android:layout_weight="1"
来撑开布局,使得按钮能够与底部对齐。
推荐的腾讯云相关产品:腾讯云移动应用分析(MTA),该产品可以帮助开发者实时监控和分析移动应用的用户行为和性能数据,提供数据分析、用户行为分析、漏斗分析等功能。产品介绍链接地址:https://cloud.tencent.com/product/mta
领取专属 10元无门槛券
手把手带您无忧上云