English 中文(简体)
SoftKey板藏匿EditText
原标题:SoftKeyboard hiding EditText

我有一个布局,利用EditText,让用户查询数据库,并填写一份名单。 EditText从屏幕上排出大约2/3的路程(放在图像上,随后是一些透镜上)。

问题是,软键板藏着EditText,因此用户可以看他打什么。 (残疾者)

我曾尝试过“线性”、“相对性”、“休妻”和不同的调和/集中,但我仍然可以让它工作。 EditText要么藏匿,要么被推倒在屏幕上,要么被“默许”和歪曲。

建议?

一个可能的工作是把EditText提升到屏幕上。 然而,这偏离了我提供的图形设计。

另一个可能的工作是使软键板在完全的屏幕上开放(但并不确定如何)。 这仍然隐藏着EditText,但是,我可以重新接收汽车,以便用户能够看到他打字......,因为他只能看到他的打字。

我最近试图这样做。 见“内部框架”。

<?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>
最佳回答

http://developer.android.com/guide/topics/mani.4/1999//active-element.html#wsoft"windowSoftInputMode 属性。 您将这一点列入您的Manifest。

  • adjustResize: "The activity s main window is always resized to make room f或 the soft keyboard on screen."

  • adjustPan: "The activity s main window is not resized to make room f或 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."

只要你在一份意见书中总结出布局,调整后的恢复或许会为你工作。 如果你在背景中具有比照图形象,也会有负面影响,因为如果是这样的话,你可能希望改用。

<activity android:windowSoftInputMode="adjustResize" />

<activity android:windowSoftInputMode="adjustPan" />

M或e inf或mation is available at the above link.

问题回答

我为我所做的工作是,把我最高级别的线索降为滚动词句(雕像只能有一个孩子)。 这使整个活动/计划得以发展,而不是把EditText集中起来。

第一,我在活动中:

<activity android:windowSoftInputMode="adjustPan" />

接着,我谈的是:

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
  <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- STUFF -->

  </LinearLayout>
</ScrollView>

1. 表面上的公正使用......

  <activity
        android:windowSoftInputMode="adjustPan">

试图使登革体案文成为一种排他性(即布局-加权=1) ,这可能对你可能不得不通过的其他布局项目产生某些其他影响,但是这可能有助于在软键板上登峰时保持可见度。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签