Search code examples
androidmessage

Android New Message type recipient control


Is anyone know how can I replicate/mirror the New message To / Recipient bar functionality, please? Is there a built in control or widget available or do I have to custom build that? or is there any examples available? I tried a few terms but not sure what is the exact term I should be using. Is used terms like "android message recipient bar", "android message to bar" etc. but nothing returned that is useful to me...

enter image description here

still under construction but this is how it looks at present.... enter image description here


Solution

  • You can do something like this, marginLeft="-1dp" is just quick solution to avoid workaround to create shape with only one side border. To avoid using this dirty solution: How to draw border on just one side of a linear layout?

    layout.xml

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <Button
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:text="Able John"
            android:textAllCaps="false"
            android:background="@drawable/background"
            />
        <Button
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginLeft="-1dp"
            android:background="@drawable/background_right_corners"
            />
    
    </LinearLayout>
    

    drawable/background

    <?xml version="1.0" encoding="utf-8"?>
    

    <solid android:color="#fff"/>
    <stroke android:width="1dp" android:color="#5000"/>
    <corners
        android:bottomLeftRadius="5dp"
        android:topLeftRadius="5dp"
        />
    
    </shape>
    

    drawable/background_right_corners

    <?xml version="1.0" encoding="utf-8"?>
    

    <solid android:color="#fff"/>
    <stroke android:width="1dp" android:color="#5000"
        />
    <corners
        android:bottomRightRadius="5dp"
        android:topRightRadius="5dp"
        />