2016-07-13 8 views
1

私はedittext listviewを持つXMLレイアウトを持っています。また、画面上で大きな部分を占めるリニアレイアウトに含まれているファブがあります。非常に小さなボタンまたはクロップド。私はここにこれらの三つの要素の最高のフィット感を持つことができますどのようにフローティングアクションボタンのカスタムビューをリストビューと合わせるには

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

<EditText 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:inputType="textPersonName" 
    android:ems="10" 
    android:id="@+id/inputSearch" 
    android:hint="Αναζητηση" /> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_weight="1" 
    android:layout_margin="4dp"> 

    <ListView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/listCustomers" 
     android:layout_margin="5dp" 
     android:dividerHeight="2dp" /> 
</LinearLayout> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_weight="2" 
    android:layout_gravity="bottom|center" 
    android:gravity="right" 
    android:layout_margin="4dp"> 

    <android.support.design.widget.FloatingActionButton 
     android:layout_width="56dp" 
     android:layout_height="56dp" 
     android:id="@+id/fab" 
     app:backgroundTint="@android:color/holo_orange_light" 
     android:layout_gravity="bottom|center" 
     android:layout_margin="10dp" 
     android:src="@drawable/ic_action_cross" /> 
</LinearLayout> 

答えて

0

は、以下を使用して完全なレイアウトを交換してください:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<EditText 
    android:id="@+id/inputSearch" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:ems="10" 
    android:hint="Αναζητηση" 
    android:inputType="textPersonName" /> 

<ListView 
    android:id="@+id/listCustomers" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/inputSearch" 
    android:layout_margin="9dp" 
    android:dividerHeight="2dp" /> 


<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="56dp" 
    android:layout_height="56dp" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentBottom="true" 
    android:layout_margin="14dp" 
    android:src="@drawable/ic_action_cross" 
    app:backgroundTint="@android:color/holo_orange_light" /> 
</RelativeLayout> 
+0

はいが良さそうに見えますが、工場のボタンはテキストとIMAGEBUTTON ListView項目の –

+1

ちょうどアンドロイド追加カバー:FloatActionButtonにlayout_below =「@ + ID/listCustomersを」と、それは意志それらをカバーしないでください。 – Drv

関連する問題