久久久久久久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問題)
主站蜘蛛池模板: 欧美精品二区三区四区免费看视频 | 欧美午夜精品 | 欧美日韩在线免费观看 | 亚洲色欧美| 免费成人深夜夜国外 | 一级片在线视频 | av一二三区 | 中文字幕免费av | 国产黄色av网站 | 欧美亚洲 | 成年人免费视频网站 | 国产传媒在线观看 | 一级毛片久久久 | www一级片 | 亚洲欧美精品 | 91精品国产乱码久久久 | 日韩精品在线观看视频 | 国产在线欧美 | 亚洲综合天堂 | 亚洲精品社区 | 亚洲成人av在线播放 | 97国产视频| 亚洲免费视频观看 | 午夜黄色小视频 | 成人国产精品一区二区 | 欧美精品一区在线观看 | 色综合色综合 | 伊人av在线| 国产欧美激情 | 精品欧美一区二区精品久久 | 日韩大片在线观看 | 999在线视频| 久久久综合网 | 免费的黄色大片 | 韩国三级av | 日韩精品在线一区二区 | 国产欧美久久久 | 无遮挡在线观看 | 亚洲精品视频免费观看 | 久草综合在线 | 国产免费成人 |