久久久久久久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問題)
主站蜘蛛池模板: 福利视频一区二区 | 国产成人精品久久二区二区 | 久久久亚洲一区 | 不卡视频在线 | 久久中文视频 | 日韩三级免费网站 | 日本a视频| 国产精品视频免费播放 | 日韩一区二区在线视频 | 91资源在线 | 99精品国产一区二区青青牛奶 | 天天操夜夜拍 | 久久久久久久久久久久久久av | 精品久久久久一区二区国产 | 毛片入口 | 亚洲国产精品久久久 | 久久久精彩视频 | 国产精品久久久久久久免费观看 | 黄色免费网站在线看 | 日日拍夜夜| 精品视频一区二区三区在线观看 | 在线不卡一区 | 国产精品视频一区二区三区 | 亚洲一区二区视频 | 成人三级电影 | 国产精品日韩一区 | 亚洲国产精品99久久久久久久久 | 国产精品无码永久免费888 | 黄色一级大片在线免费看产 | 国产精品成人在线观看 | 亚洲不卡av在线 | www国产精品 | 一区二区三区国产精品 | 精品不卡| 一区二区三区在线 | 欧 | 日韩国产在线 | 亚洲国产欧美精品 | 神马久久久久久久久久 | 99精品国产一区二区三区 | 欧美一区二区三区在线观看 | 天天操操|