2016-05-04 8 views
0

Hey Leute Ich habe das Problem, dass, wenn der ListView wächst, geht es hinter den editText ... Ich will nicht, dass es hinter der Ansicht geht .. Ich will es über den editText bleiben .. könntest du mir helfen? Ich schätze Ihre Hilfe.Warum geht das listVIEW hinter EditText?

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

    <ListView 
     android:id="@+id/list_view" 
     android:layout_width="match_parent" 
     android:layout_weight="1" 
     android:layout_height="0dp" 
     android:paddingBottom="10dp"></ListView> 

    <GridLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:columnCount="2"> 

     <EditText 
      android:id="@+id/edit_text" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_column="0" 
      android:layout_row="0" 
      android:layout_gravity="fill_horizontal|bottom" 
      android:hint="Type text here..." 
      android:maxLines="3" 
      android:scrollbars="vertical" 
      android:maxEms="10"/> 

     <Button 
      android:id="@+id/button" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_column="1" 
      android:layout_row="0" 
      android:text="Send" 
      android:layout_gravity="bottom" 
      android:onClick="insertTo" 
      /> 
    </GridLayout> 
</LinearLayout> 

enter image description here

+0

Sein nicht hinter dem 'editText' gehen, sein die letzte Grenze Text zum Scrollen am Ende der 'Listview'-Grenze. – Pankaj

+0

es geht nicht zurück. Dies ist das Standardverhalten, da Ihr Hauptlayout ein lineares Layout ist und untergeordnete Objekte vertikal ausgerichtet sind. Dies wird aufgrund von paddingBottom in listview angezeigt –

Antwort

1
<ListView 
    android:id="@+id/list_view" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:paddingBottom="10dp"></ListView> 
1

dieses Versuchen, änderte sich die Gewicht der Ansichten

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

    <ListView 
     android:id="@+id/list_view" 
     android:layout_width="match_parent" 
     android:layout_weight="0.97" 
     android:layout_height="0dp" 
     android:paddingBottom="10dp"></ListView> 

    <GridLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.03" 
     android:columnCount="2"> 

     <EditText 
      android:id="@+id/edit_text" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_column="0" 
      android:layout_row="0" 
      android:layout_gravity="fill_horizontal|bottom" 
      android:hint="Type text here..." 
      android:maxLines="3" 
      android:scrollbars="vertical" 
      android:maxEms="10"/> 

     <Button 
      android:id="@+id/button" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_column="1" 
      android:layout_row="0" 
      android:text="Send" 
      android:layout_gravity="bottom" 
      android:onClick="insertTo" 
      /> 
    </GridLayout> 
</LinearLayout> 
0

Entfernen:android:layout_weight="1" von Listview

Es sieht aus wie:

<ListView 
android:id="@+id/list_view" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:paddingBottom="10dp"></ListView> 
0

eine RelativeLayout als Root-Ansicht Ihres xml verwenden.

Geben Sie der GridLayout eine ID, und machen Sie es alignParentBottom = "True". Halten Sie Ihre ListView über dem GridLayout. Was es aussehen sollte ist:

<ListView 
     android:id="@+id/list_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/gridviewItem"> 
</ListView> 

and GridView item should look like: 

<GridLayout 
     android:id="@+id/gridviewItem" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.03" 
     android:columnCount="2"> 

// Grid View Artikel />

hoffe, das hilft ....