【发布时间】:2015-12-14 07:12:34
【问题描述】:
我在ScrollView 有问题。我有一个布局,我使用ScrollView 有一个位于底部的Button。当我点击EditText 然后显示键盘时,我的按钮在我的键盘上向上移动(Button 女巫是底部位置,在我的清单文件中使用这个 windowSoftInputMode
<activity
android:name=".activities.MainActivity"
android:screenOrientation="sensorPortrait"
android:theme="@style/NoTitleBar"
android:windowSoftInputMode="stateAlwaysHidden"
>
这是我的 xml 代码
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:clickable="true">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/upload_main_layout_upload"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/lay_v3"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/transfer_headerView_height"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:background="#f2f2f2"
android:layout_alignParentStart="true"
android:id="@+id/upload_header_layout">
<Button
android:layout_width="@dimen/withdrow_change_card_width"
android:layout_height="@dimen/withdrow_change_card_height"
android:text="@string/u_slide_menu_change_card_v1"
android:background="@drawable/rounded_corners_withdrow"
android:id="@+id/upload_choose_card_main"
android:layout_centerVertical="true"
android:textColor="#4c4c4c"
android:textSize="@dimen/u_common_text_size_small"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/u_common_margin_left"
android:layout_marginRight="@dimen/u_common_margin_left"
android:layout_marginTop="@dimen/withdrow_change_card_height"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/edittext_input_background_not_focus"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/u_common_margin_left"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:orientation="vertical"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_menu_downarrow_grey"
android:layout_centerVertical="true"
android:visibility="invisible"
android:padding="@dimen/slide_menu_hide_image"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/u_transfer_currency_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/u_widget_height"
android:layout_alignParentTop="true"
>
<EditText
android:id="@+id/u_major_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:singleLine="true"
android:maxLines="1"
style="@style/u_edit_text"
android:textSize="@dimen/u_common_text_size_extra_large"
android:hint="0.00"
android:inputType="numberDecimal"
android:background="@null"
/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/bootom_layout"
android:paddingRight="@dimen/u_common_margin_left"
android:paddingLeft="@dimen/u_common_margin_left"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Button
android:id="@+id/u_done"
android:layout_width="fill_parent"
android:layout_height="@dimen/u_widget_height"
android:background="@drawable/rounded_corners_blue"
android:textColor="#ffffff"
android:textSize="@dimen/u_common_text_size"
android:text="@string/u_menu_upload" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/u_common_margin_left"
android:visibility="invisible"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
我不需要向上移动按钮键盘。我想要在键盘显示时简单滚动。我也在我的清单文件中尝试过这个,但没有工作
android:windowSoftInputMode="adjustResize"
我做错了什么?如果有人知道解决方案,请帮助我谢谢大家
【问题讨论】:
-
试试 android:windowSoftInputMode="adjustNothing"
-
这里是工作代码...stackoverflow.com/questions/7417123/…
标签: android android-edittext android-linearlayout android-scrollview