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

SoftKeyboard 隱藏 EditText

SoftKeyboard hiding EditText(SoftKeyboard 隱藏 EditText)
本文介紹了SoftKeyboard 隱藏 EditText的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號(hào)..

我有一個(gè)布局,它使用 EditText 讓用戶搜索數(shù)據(jù)庫(kù)并填充 ListView.EditText 大約是屏幕頂部的 2/3(位于 ImageView 上方,然后是一些介紹性文本.)

I have a layout that uses an EditText to let users search a database and populate a ListView. The EditText is about 2/3 of the way from the top of the screen (positioned over an ImageView, and followed by some intro text.)

問題是軟鍵盤隱藏了 EditText,所以用戶看不到他在輸入什么.(我禁用了自動(dòng)建議.)

The problem is that the soft keyboard hides the EditText, so the user can't see what he's typing. (I disabled the auto-suggest.)

我已經(jīng)嘗試過 LinearLayout、RelativeLayout、填充和不同的對(duì)齊/居中,但我仍然無法讓它正常工作.EditText 要么被隱藏,要么被推離屏幕頂部,要么被壓扁"并扭曲.

I've tried LinearLayout, RelativeLayout, paddings, and different alignments/centerings, but I still can't get it to work right. The EditText is either hidden, gets pushed off the top of the screen, or get "squished" and distorted.

建議???

一種可能的解決方法是將 EditText 移動(dòng)到屏幕頂部.但是,這與我得到的圖形設(shè)計(jì)有所不同.

One possible workaround is to move the EditText to the top of the screen. However, this deviates from the graphic design that I was given.

另一個(gè)可能的解決方法是讓軟鍵盤全屏打開(但不確定如何).這仍然會(huì)隱藏 EditText,但隨后我可以重新啟用自動(dòng)建議,以便用戶可以看到他正在輸入的內(nèi)容......有點(diǎn)......因?yàn)樗荒芸吹?suggestions 的內(nèi)容他在打字.

Another possible workaround is for me to make the soft keyboard open in full screen (not sure how, though). This will still hide the EditText, but then I can re-enable the auto-suggestion so the user can see what he's typing... sort of... because he can only see the suggestions for what he's typing.

這是我最近的嘗試.參見introFrame".

Here's my latest attempt. See "introFrame".

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="wrap_content" 
 android:layout_height="fill_parent"
 android:orientation="vertical">

 <LinearLayout android:id="@+id/titleContainer"
  android:orientation="horizontal" android:layout_width="fill_parent"
  android:layout_height="wrap_content">
  <TextView android:text="@string/title_string"
   android:textSize="15sp" android:textColor="#FFFFFF"
   android:textStyle="bold" android:paddingLeft="5dp"
   android:layout_height="fill_parent" android:layout_width="wrap_content" />
 </LinearLayout>

 <FrameLayout 
 android:id="@+id/introFrame"
 android:layout_width="fill_parent" 
 android:layout_height="wrap_content"
 android:gravity="center_horizontal" >
 <ImageView 
  android:src="@drawable/main_search_image"
  android:scaleType="center"
  android:layout_gravity="center"
  android:layout_height="wrap_content"
  android:layout_width="wrap_content"/>
 <LinearLayout
  android:orientation="vertical"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"
  android:paddingTop="140dp" >
  <LinearLayout android:id="@+id/introSearchContainer"
   android:orientation="horizontal" 
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:layout_gravity="center_vertical" >
   <LinearLayout 
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1" >
    <EditText android:id="@+id/intro_search_box" 
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:hint="     Enter keyword     " 
     android:imeOptions="actionGo"   
     android:inputType="textFilter" 
     android:maxLines="1" />
   </LinearLayout>
   <LinearLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
    <Button android:id="@+id/intro_search_button" 
     android:background="@drawable/custom_button_go"
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" />
    </LinearLayout>
  </LinearLayout>
  <TextView
   android:text="@string/search_intro"
   android:textSize="15sp"
   android:textColor="#FFFFFF"
   android:layout_height="wrap_content"
   android:layout_width="fill_parent" /> 
 </LinearLayout>
 </FrameLayout>

 <LinearLayout android:id="@+id/listContainer"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <ListView android:id="@+id/itemlist" android:layout_width="wrap_content"
   android:layout_height="wrap_content" android:cacheColorHint="#00000000" />
  <TextView android:text="No data found" android:layout_width="fill_parent"
   android:layout_height="fill_parent" android:gravity="center"
   android:textSize="16sp" android:textColor="#FFFFFF" android:id="@+id/android:empty" />
 </LinearLayout>

</LinearLayout>

推薦答案

你要找的是Activity的windowSoftInputMode 屬性.你在你的 AndroidManifest.xml 文件中設(shè)置它,并給它一個(gè)值,例如:

What you're looking for is the Activity's windowSoftInputMode attribute. You set this in your AndroidManifest.xml file, and give it a value such as:

  • adjustResize:Activity 的主窗口總是調(diào)整大小,以便為屏幕上的軟鍵盤騰出空間."

  • adjustPan:活動(dòng)的主窗口沒有調(diào)整大小來為軟鍵盤騰出空間.相反,窗口的內(nèi)容會(huì)自動(dòng)平移,這樣當(dāng)前的焦點(diǎn)就不會(huì)被鍵盤和用戶始終可以看到他們正在輸入的內(nèi)容.這通常不如調(diào)整大小,因?yàn)橛脩艨赡苄枰P(guān)閉軟鍵盤才能到達(dá)窗口的模糊部分并與之交互."
  • adjustResize: "The activity's main window is always resized to make room for the soft keyboard on screen."

  • adjustPan: "The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window."

adjustResize 可能對(duì)您有用,只要您將布局包裝在 ScrollView 中.如果您在背景中有位圖圖像,它可能會(huì)產(chǎn)生負(fù)面影響,因?yàn)樗矔?huì)被調(diào)整大小,在這種情況下,您可能需要使用 adjustPan.

adjustResize will probably work for you, as long as you wrap the layout in a ScrollView. It may have negative effects if you have a bitmap image in the background, as it will be resized as well, in which case you may want to use adjustPan instead.

<activity android:windowSoftInputMode="adjustResize" />

<activity android:windowSoftInputMode="adjustPan" />

更多信息可以在上面的鏈接中找到.

More information is available at the above link.

這篇關(guān)于SoftKeyboard 隱藏 EditText的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
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 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 国产免费黄网 | 日韩成人一区二区 | 午夜小视频在线播放 | 日本三级网| 精品久久久久久 | 99在线资源 | 国产精品久久久久久久久久免费看 | 国产香蕉视频在线播放 | 99国产视频 | 精品亚洲永久免费精品 | 黄色毛片网站在线观看 | 亚洲综合大片69999 | 成人一区在线观看 | 日韩一区二区久久 | 欧美精品久久久 | 男人天堂色 | 国产午夜精品一区二区三区四区 | 精品在线视频播放 | 欧美一区二区三区在线观看 | 久久av网 | www精品 | 日韩视频精品 | 精品视频在线观看 | 91精品国产综合久久香蕉922 | 久久手机在线视频 | 自拍偷拍亚洲一区 | 亚洲高清视频一区二区 | av在线免费播放 | av网站免费在线观看 | 一区二区在线免费观看视频 | 丝袜 亚洲 欧美 日韩 综合 | 日韩av最新网址 | 91精品国产91久久久久久 | 成人久久久 | 国产激情视频在线 | 成人免费看黄网站在线观看 | 黄色一级视频 | 国产精品久久久久久久久久免费看 | 三级视频国产 | 91精品一区| 亚洲在线一区 |