在android中移动软键盘上方的按钮 [英] Move buttons above soft keyboard in android

查看:76
本文介绍了在android中移动软键盘上方的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据无处不在的解决方案设计了以下布局。



我在清单文件中设置了android:windowSoftInputMode =adjustResize | stateVisible也好。



我仍​​然无法获得软键盘上方的线性布局图像按钮。任何人都可以指出这个布局有什么问题。





I have designed the below layout as per so many solutions provided by everywhere.

I have set the android:windowSoftInputMode="adjustResize|stateVisible" in Manifest file too.

Still I cannot get the linear layout image buttons above the soft keyboard. Can anybody point me what's wrong with this layout.


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:id="@+id/crbox_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation=">
    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/m_table_menu">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <EditText
                android:id="@+id/new_box_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="10"
                android:hint="Title"
                android:inputType="textPersonName" />
            <EditText
                android:id="@+id/new_box_descri"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Description"
                android:gravity="top"
                android:inputType="textCapSentences|textMultiLine"
                android:lines="5"
                android:windowSoftInputMode="stateAlwaysVisible" />
        </LinearLayout>
    </ScrollView>
<LinearLayout
    android:id="@+id/m_table_menu"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_alignParentBottom="true">
    <ImageButton
        android:id="@+id/cameraButton"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:contentDescription="Open Camera"
        app:srcCompat="@drawable/ic_box_camera_icon" />
    <ImageButton
        android:id="@+id/galleryButton"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:contentDescription="Choose Image"
        app:srcCompat="@drawable/ic_box_image_icon" />
    <ImageButton
        android:id="@+id/imageButton"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:layout_weight="1"
        android:background="@android:color/white"
        android:contentDescription="Choose Color"
        app:srcCompat="@drawable/ic_box_color_icon" />
</LinearLayout>
</RelativeLayout>





我尝试过:



我已经尝试将下面的LinearLayout替换为TableLayout,仍然没有帮助。



What I have tried:

I have tried replacing the below LinearLayout to TableLayout, still not helping.

推荐答案

在你的java类中添加这一行



Add this line in your java class

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);





在此处阅读答案以获取更多参考:有没有办法改变android:windowSoftInputMode值来自java类? - 堆栈溢出 [ ^ ]


这篇关于在android中移动软键盘上方的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆