Android布局页面无法滚动至底部问题求助
实现Android用户反馈页面布局
我来帮你梳理这个用户反馈页面的布局实现——页面包含TextView、RatingBar、EditText这些核心控件,底部还有一个大的提交按钮,你提供的布局文件代码如下:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".FeedbackActivity"> <!-- 可补充TextView、RatingBar、EditText的具体布局代码 --> <!-- 示例结构参考: --> <!-- <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" android:padding="16dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="请为我们的服务评分" android:textSize="18sp" android:textStyle="bold"/> <RatingBar android:id="@+id/ratingBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:numStars="5" android:rating="3" android:layout_marginVertical="16dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="请写下您的反馈意见" android:textSize="16sp"/> <EditText android:id="@+id/feedbackEt" android:layout_width="match_parent" android:layout_height="150dp" android:hint="请输入您的反馈..." android:gravity="top" android:layout_marginVertical="16dp"/> </LinearLayout> </ScrollView> --> <!-- 底部提交按钮 --> <Button android:id="@+id/submitBtn" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="提交反馈" android:textSize="18sp" android:background="@color/colorPrimary" android:textColor="@android:color/white" app:layout_anchorGravity="bottom"/> </android.support.design.widget.CoordinatorLayout>
给你几个实用小建议,优化页面体验:
- 给
RatingBar设置android:numStars(比如5星)和android:rating(默认评分),让评分控件更直观 EditText加上android:hint提示用户输入内容,同时设置android:gravity="top"让输入从顶部开始,适配多行反馈场景- 用
ScrollView包裹上方内容区域,避免内容过多时被底部按钮遮挡,同时适配小屏幕设备 - 在AndroidManifest.xml中给这个Activity添加
android:windowSoftInputMode="adjustResize",确保软键盘弹出时布局不会被遮挡
内容的提问来源于stack exchange,提问作者anta40
相关产品推荐
相关产品推荐

