J'essaie d'ajouter un bouton d'action flottante dans l'une de mes mises en page. J'ai créé une disposition distincte pour le bouton d'action flottante à inclure dans la disposition principale de la mine. mais chaque fois que je l'inclue, ce n'est pas en haut de la liste.Inclure le bouton d'action flottante au-dessus de ListView
Bouton Floating Action XML:
<?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">
<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="23dp"
android:layout_marginEnd="22dp"
android:clickable="true"
app:fabSize="mini"
app:srcCompat="@android:drawable/ic_menu_add" />
</RelativeLayout>
mise en page d'activité:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:weightSum="1"
android:background="@color/BG_beige">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="10dp">
<TextView
android:id="@+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.58"
android:text="Name"
android:textSize="20sp"/>
<TextView
android:id="@+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textSize="20sp"/>
<TextView
android:id="@+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.51"
android:text="Paid"
android:textSize="20sp"
android:gravity="center"/>
</LinearLayout>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
layout="@layout/utility_fab"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
Ainsi, la mise en page qui en résulte est la suivante:
mais ne pas la mise en page de trame détruire mon positionnement actuel? parce que im utilisant linéaire – JJCADIZ
'FrameLayout' est seulement utilisé pour aligner listview et bouton d'action flottant ... il n'affectera pas linearlayout – rafsanahmad007