2016-07-01 10 views
1

Ich habe das folgende LayoutEditText und Suchtaste schrumpft und gehen außerhalb der Grenzen

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:orientation="vertical" 
    tools:context="com.example.android.booklistings.MainActivity"> 
    <RelativeLayout 
     android:layout_weight="2" 
     android:layout_width="match_parent" 
     android:layout_height="0dp"> 
     <EditText 
      android:id="@+id/search_text" 
      android:layout_marginTop="10dp" 
      android:imeOptions="actionSearch" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:hint="Type the name of book" 
      android:inputType="text"/> 
     <ImageButton 
      android:layout_toRightOf="@id/search_text" 
      android:layout_toEndOf="@id/search_text" 
      android:id="@+id/search_button" 
      android:adjustViewBounds="true" 
      android:scaleType="centerCrop" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/search" /> 
    </RelativeLayout> 
    <ListView 
     android:layout_weight="8" 
     android:id="@+id/book_list" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="0dp"> 
    </ListView> 
</LinearLayout> 

Ich verstehe nicht, warum ich nicht die editbox deutlich sehen kann, wenn Tastatur auf dem Bildschirm erscheint! Ich habe Listenansicht und einen Editiertext. Wenn ich etwas eintippe und die Suchtaste drücke, wird die Listenansicht ausgefüllt und über meinen benutzerdefinierten Adapter mit vielen Ansichten gefüllt.

Ich kann die editbox sehen, wenn die Tastatur auf dem Bildschirm fein Die Liste erscheint Ansicht ist ..

+0

Geben Sie Ihrem Bearbeitungstext eine Breite oder die Breite match_parent. – Drv

+0

es verwendet match_parent dann verschwindet die Schaltfläche ..; – user3787757

+0

Gib imagebutton auch etwas width oder match_parent – Drv

Antwort

1

können Sie sehen nicht Ihre EditText, weil es sich wie die Soft-Tastatur erscheint verschoben wird.

dieses Schaltverhalten zu stoppen, müssen Sie hierfür sind:

android:windowSoftInputMode="adjustPan|adjustResize"

im corresponsing Aktivitäts-Tag Ihrer Manifest-Datei.