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 ahbottomnavigation library for making my bottombar.
Defining RelativeLayout in layout XML This is done by using the android:layout_below="@+id/textView" attribute in both the Button tags. We have aligned both the buttons from the top margin (of each other), using android:layout_alignTop="@id/button" attribute.
If you want to add Buttons to the bottom of your android layout XML file you can achieve it using attribute layout_gravity on LinearLayout or TableRow layout. Below your Parent Layout tag add a LinearLayout or TableRow with attribute android:layout_gravity="bottom".
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With