Search code examples
androidandroid-layoutevernote

How to create a sliding bar for buttons in my Android App like that of the Sliding bar in Evernote for Bold, Italics, Underline etc


Here is a link to the image of the Evernote app with the sliding bar at the bottom


Solution

  • I figured an answer to my own question. Here is the code:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent">
        <HorizontalScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent">
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="Button 1"/>
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="Button 2"/>
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="Button 3"/>
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="Button 4"/>
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="Button 5"/>
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="Button 6"/>
    
            </LinearLayout>
        </HorizontalScrollView>
    </LinearLayout>