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

SoftKeyboard 隱藏 EditText

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

問題描述

限時送ChatGPT賬號..

我有一個布局,它使用 EditText 讓用戶搜索數據庫并填充 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,所以用戶看不到他在輸入什么.(我禁用了自動建議.)

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.)

我已經嘗試過 LinearLayout、RelativeLayout、填充和不同的對齊/居中,但我仍然無法讓它正常工作.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 移動到屏幕頂部.但是,這與我得到的圖形設計有所不同.

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.

另一個可能的解決方法是讓軟鍵盤全屏打開(但不確定如何).這仍然會隱藏 EditText,但隨后我可以重新啟用自動建議,以便用戶可以看到他正在輸入的內容......有點......因為他只能看到 suggestions 的內容他在打字.

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 文件中設置它,并給它一個值,例如:

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 的主窗口總是調整大小,以便為屏幕上的軟鍵盤騰出空間."

  • adjustPan:活動的主窗口沒有調整大小來為軟鍵盤騰出空間.相反,窗口的內容會自動平移,這樣當前的焦點就不會被鍵盤和用戶始終可以看到他們正在輸入的內容.這通常不如調整大小,因為用戶可能需要關閉軟鍵盤才能到達窗口的模糊部分并與之交互."
  • 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 可能對您有用,只要您將布局包裝在 ScrollView 中.如果您在背景中有位圖圖像,它可能會產生負面影響,因為它也會被調整大小,在這種情況下,您可能需要使用 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.

這篇關于SoftKeyboard 隱藏 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中文在线观看 | 成年人免费看的视频 | 久久国产视频网站 | 99爱在线视频 | 久久在线 | 欧美成年网站 | 成人精品视频免费 | 日韩毛片在线免费观看 | 日韩综合在线视频 | www.亚洲视频 | 桃花av在线 | www精品| 羞视频在线观看 | www.一区二区三区 | 91免费在线播放 | 国产伦精品一区二区三区照片91 | 在线观看亚洲 | 欧美精品一二三区 | 天天干国产 | 久久久国产一区二区三区四区小说 | 久久精品中文 | 亚洲欧美中文字幕在线观看 | 日本特黄a级高清免费大片 国产精品久久性 | 中文成人在线 | 久久久久亚洲精品 | 日韩一二区 | 国产精品自拍一区 | 澳门永久av免费网站 | 免费视频99| 国产高清一区二区 | 国产一区精品在线 | 欧美一区免费在线观看 | 亚洲一区二区在线电影 | 免费成人毛片 | 国产视频二区 | 一区二区视频在线观看 | 午夜影院在线观看 | 成人福利网站 | 午夜精品影院 |