Last active
September 20, 2016 17:01
-
-
Save ankitsinghaniyaz/9f36098bc29446e46ea2bd89b1d15664 to your computer and use it in GitHub Desktop.
Google Plus Like Bottom Toolbar Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!--This is the main frame layout in which I set hight, background and align it to the bottom--> | |
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/toolbar" | |
android:layout_width="match_parent" | |
android:layout_height="80dp" | |
android:layout_alignParentBottom="true" | |
android:layout_gravity="bottom" | |
android:background="@color/colorPrimaryDark" | |
android:elevation="4dp"> | |
<!--This linear layout is a wrapper for all the button which are added.--> | |
<!--It should be horizontal and change weightsum to the number of buttons you want to add--> | |
<LinearLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="horizontal" | |
android:weightSum="6"> | |
<!--All these are just wrapper for image view and text view that will act as button--> | |
<!--They have a vertical layout, center gravity and clickable true--> | |
<!--They also have layout weight as 1 to divide space equally amongst buttons--> | |
<!--Also enable haptic feedback if you want to create touch vibration on click--> | |
<LinearLayout | |
android:layout_width="0dp" | |
android:layout_height="match_parent" | |
android:layout_weight="1" | |
android:background="@drawable/button_background" | |
android:clickable="true" | |
android:gravity="center" | |
android:hapticFeedbackEnabled="true" | |
android:onClick="toggleAlignment" | |
android:orientation="vertical"> | |
<!-- A text view pointing to drawable--> | |
<!--make sure to make clickable false--> | |
<ImageView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:clickable="false" | |
android:src="@drawable/align" | |
/> | |
<!--A txt view to add text below the image--> | |
<!--Align it to the center and change size as you find fit--> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:gravity="center" | |
android:text="Align" | |
android:textSize="12sp"/> | |
</LinearLayout> | |
<LinearLayout | |
android:layout_width="0dp" | |
android:layout_height="match_parent" | |
android:layout_weight="1" | |
android:background="@drawable/button_background" | |
android:clickable="true" | |
android:gravity="center" | |
android:hapticFeedbackEnabled="true" | |
android:onClick="toggleFont" | |
android:orientation="vertical"> | |
<ImageView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:clickable="false" | |
android:src="@drawable/font" | |
/> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:gravity="center" | |
android:text="Font" | |
android:textSize="12sp"/> | |
</LinearLayout> | |
</LinearLayout> | |
</FrameLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment