2017-07-24 6 views
0

Ich möchte Textansicht unter der Suchleiste platzieren. Ich habe layout_below verwendet, aber der Text wird nicht angezeigt.Android XML layout_below funktioniert nicht

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <com.arlib.floatingsearchview.FloatingSearchView 
     android:layout_margin="@dimen/cardview_margin" 
     android:id="@+id/map_floating_search_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:floatingSearch_close_search_on_keyboard_dismiss="true" 
     app:floatingSearch_leftActionMode="showHamburger" 
     app:floatingSearch_searchBarMarginLeft="@dimen/search_view_inset" 
     app:floatingSearch_searchBarMarginRight="@dimen/search_view_inset" 
     app:floatingSearch_searchBarMarginTop="@dimen/search_view_inset" 
     app:floatingSearch_searchHint="Search for a room..." 
     app:floatingSearch_showSearchKey="false" 
     app:floatingSearch_suggestionsListAnimDuration="250" /> 


    <EditText 
     android:layout_margin="@dimen/cardview_margin" 
     android:id="@+id/edit_text_destination" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/map_floating_search_view" 
     android:hint="To" /> 

    <Button 
     android:id="@+id/directions_go_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:layout_margin="@dimen/cardview_margin" 
     android:text="GO!" /> 

    <CheckBox 
     android:id="@+id/checkbox_routing_criteria" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:onClick="onCheckboxClicked" 
     android:text="@string/avoid_indoor_pathways" 
     android:layout_margin="@dimen/cardview_margin" 
     android:textColor="@color/colorPrimary" /> 

</RelativeLayout> 

Ich möchte edit_text_destination unter FloatingSearchView sein. Ich bin mir nicht sicher, warum es nicht funktioniert. Wenn ich FloatingSearchView durch eine andere Textansicht ersetze, funktioniert es. Ich kämpfe eine Weile damit. Könnte mir jemand helfen?

Dank

+0

Haben Sie überprüft, wie es im Beispiel der Bibliothek implementiert wurde? Nimm dir eine Idee von dort. Vielleicht wird dir das helfen. –

+0

'FloatingSearchView' bläht [' floating_search_layout.xml'] auf (https://github.com/arimorty/floatingsearchview/blob/a0f8fbc90d98eb1b629c6295dd2d3577412e7b1e/library/src/main/res/layout/floating_search_layout.xml), das 'match_parent/match_parent hat 'Höhe. – azizbekian

Antwort

0

Try statische Höhe in com.arlib.floatingsearchview.FloatingSearchView als Suchfeld nimmt für seine Ergebnisse der Bildschirm gesamte Höhe zu verwenden, durch die die edit_text Sie wird unten verwenden verschoben und wird aus dem Bildschirm .. Sie Überprüfen Sie dies, indem Sie scrollView anwenden, also versuchen Sie, die Höhe wie 100dp oder 200dp zu geben. ODER Wenn Sie den editText beim Klicken auf searchBar deaktivieren möchten und keine statische Höhe angeben möchten, können Sie dies auch verwenden.

 <EditText 
      android:id="@+id/edit_text_destination" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="99dp" 
      android:hint="To" 
      android:layout_alignParentTop="true" 
      android:layout_alignRight="@+id/directions_go_button" 
      android:layout_alignEnd="@+id/directions_go_button" 
      android:layout_alignLeft="@+id/checkbox_routing_criteria" 
      android:layout_alignStart="@+id/checkbox_routing_criteria" /> 
Verwandte Themen