久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 EditText 和軟鍵盤之間添加邊距?

How to add margin between EditText and Soft Keyboard?(如何在 EditText 和軟鍵盤之間添加邊距?)
本文介紹了如何在 EditText 和軟鍵盤之間添加邊距?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我想在 EditText 和軟鍵盤之間添加 10dp 的邊距.

I want to add 10dp margin between EditText and Soft Keyboard.

這是我的 XML:

<RelativeLayout
    android:id="@+id/BottomLayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:background="@drawable/bottom_glass" >

    <EditText
        android:id="@+id/message"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:background="@drawable/grey"
        android:ems="10"
        android:layout_marginBottom="10dp"
        android:hint="Enter Message"
        android:textColor="#ffffff" >


    </EditText>

    <ImageButton
        android:id="@+id/sendMessageButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="20dp"
        android:layout_toRightOf="@+id/message"
        android:background="@android:color/transparent"
        android:src="@drawable/sendselector" />

    <ImageButton
        android:id="@+id/imageButton2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginRight="20dp"
        android:layout_toLeftOf="@+id/message"
        android:background="@android:color/transparent"
        android:src="@drawable/sendmediaselector" />

</RelativeLayout>

這是我的 onCreate() :

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
    messageText.setOnTouchListener(new OnTouchListener(){

                @Override
                public boolean onTouch(View v, MotionEvent event) {
                            ((Swipe)getActivity()).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);
                    return false;
                }});

我正在使用 viewpager 和全屏主題.以下 EditText 在我的第三個片段中.

I am using viewpager and full screen theme. The following EditText is in my 3rd fragment.

我使用了 android:windowSoftInputMode="adjustResize|adjustPan"android:windowSoftInputMode="adjustResize",但什么也沒發生.

I've used android:windowSoftInputMode="adjustResize|adjustPan" and android:windowSoftInputMode="adjustResize", but nothing happened.

推薦答案

我發現paddingBottom的屬性會影響editText和鍵盤的距離.你可以這樣做:

I find the attribute of paddingBottom can effect the distance between the editText and the keyboard. You can do like this:

<RelativeLayout   
  android:layout_width="match_parent"   
  android:layout_height="110dp"> 
  <ImageView
     android:layout_width="match_parent"
     android:layout_height="100dp"
     android:background="@drawable/your_edit_text_background"/>   
  <EditText
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingBottom="10dp"/> 
</RelativeLayout>

這將使您的鍵盤邊距 EditText 10dp

This will make your keyboard margin your EditText by 10dp

這篇關于如何在 EditText 和軟鍵盤之間添加邊距?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 久久精品性视频 | 91精品一区二区三区久久久久 | 欧美高清视频 | 高清久久久 | 国产一级电影网 | 欧美日韩久久久 | 国产欧美精品一区二区 | 中文字幕电影在线观看 | 日韩电影一区 | 日本久久久一区二区三区 | 日韩一三区 | 欧美激情一区二区三级高清视频 | 麻豆av在线免费观看 | 亚洲a在线视频 | 成人在线视频免费观看 | 成人午夜性成交 | 亚洲日本欧美日韩高观看 | 精品国产乱码久久久久久影片 | 国产精品久久久久一区二区三区 | 一区中文字幕 | 久久久精品一区 | 国产福利精品一区 | 精品国产一区二区三区免费 | 91手机精品视频 | 99精品久久 | 激情a| 久久99国产精品久久99果冻传媒 | 久久精品一区二区三区四区 | 久久精品欧美一区二区三区不卡 | 亚洲一区二区三区免费视频 | 国产在线永久免费 | 亚洲乱码一区二区三区在线观看 | 亚洲精品电影网在线观看 | 亚洲精品91 | 国产精品亚洲成在人线 | 成年精品 | 亚洲精品自在在线观看 | 在线免费观看日本视频 | 国产精品99久久久久久大便 | 国产乱码精品一区二区三区中文 | 91天堂网|