How to add the middle Button in BottomBar layout android

前端 未结 1 603
小蘑菇
小蘑菇 2021-01-06 00:19

I want to add facebook messenger like oversized button in the middle of my bottombar layout but confused how to add..

Facebook Messenger

I was using

相关标签:
1条回答
  • 2021-01-06 00:56

    I just tried to make it simple, not professional type. Look here:

    BottomSheetLayout file - tv.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:bottom="2dp"
        android:left="2dp"
        android:right="2dp"
        android:top="15dp">
        <shape android:shape="rectangle">
            <solid android:color="@color/colorPrimary" />
        </shape>
    </item>
    
    <item
        android:width="70dp"
        android:height="70dp"
        android:gravity="top|center">
        <shape android:shape="oval">
            <solid android:color="@color/colorPrimaryDark" />
    
        </shape>
    </item>
    

    ActivityLayout - activity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout android:layout_height="match_parent"
    android:layout_width="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout
        android:layout_height="80dp"
        android:layout_width="match_parent"
        android:background="@drawable/tv"
        android:gravity="bottom"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:id="@+id/view">
    
    </RelativeLayout>
    
    <ImageButton
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_marginStart="34dp"
        android:layout_alignBottom="@+id/imageButton"
        android:layout_toEndOf="@+id/imageButton"
        android:id="@+id/imageButton3" />
    
    <ImageButton
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:background="@drawable/ic_ring"
        android:layout_alignTop="@+id/view"
        android:layout_centerHorizontal="true"
        android:id="@+id/imageButton" />
    
    <ImageButton
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_marginStart="33dp"
        android:id="@+id/imageButton2"
        android:layout_alignBottom="@+id/imageButton3"
        android:layout_toEndOf="@+id/imageButton3" />
    
    <ImageButton
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:id="@+id/imageButton4"
        android:layout_marginEnd="34dp"
        android:layout_alignBottom="@+id/imageButton"
        android:layout_toStartOf="@+id/imageButton" />
    
    <ImageButton
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:id="@+id/imageButton5"
        android:layout_alignParentBottom="true"
        android:layout_toStartOf="@+id/imageButton4"
        android:layout_marginEnd="33dp"
        android:layout_marginBottom="10dp"/>
    
    </RelativeLayout>
    

    Output:

    Change value and design as per your idea.

    Example is just a demo and does not contain exact answer asked by OP. Its just a hard coded dummy.

    0 讨论(0)
提交回复
热议问题