我有一个scrollview,其中包含2个由ListView包围的TextViews和EditText,当我通过我的软键盘输入EditText时我的问题是什么,垂直条不会自动滚动到底部但稍微向上。我试过通过Stackoverflow搜索但没有用。 请赐教。
ScreenShot: https://www.dropbox.com/s/yvyyrgxmfrwqb3b/Screenshot_2013-10-24-17-30-43.png
这是我的架构的代码:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
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:visibility="visible"
tools:context=".EditorActivity"
android:scrollbarStyle="insideInset"
android:layout_marginTop="-30px"
android:layout_marginLeft="-10px"
android:layout_marginRight="-35px">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="0px" >
<TextView
android:id="@+id/tv_day_edited"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/day_modified" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/date" />
<TextView
android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="25sp" />
<EditText
android:id="@+id/etPad"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@null"
android:focusable="true"
android:includeFontPadding="true"
android:inputType="textMultiLine" />
</LinearLayout>
</ScrollView>
修改 找到了解决方案。我添加了
android:paddingBottom="15dp"
在布局中的editText属性中。 谢谢大家。
答案 0 :(得分:0)
在清单文件中添加此行。
<activity android:windowSoftInputMode="stateVisible|adjustResize" .>
答案 1 :(得分:0)
使用此代码滚动到特定位置 -
yourScrollView.post(new Runnable() {
@Override
public void run() {
yourScrollview.scrollTo(0, your_EditBox.getBottom());
}
});
答案 2 :(得分:0)
找到解决方案。我添加了
android:paddingBottom="15dp"
在布局中的editText属性中。谢谢大家。