ajay ajay - 4 months ago 8
Android Question

How to make rectangular and round corner panel like facebook

I am very new in android and want to make a rectangular and round corner pan/view in with a grey background without using facebook SDK. such pan is also used in many other mobile apps like linkedin.

Not able to post snapshot due to no reputation :(

thanks in advance.

Ajay

Answer

create shape.xml in drawable folder

like shape.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
  <stroke android:width="2dp"
     android:color="#FFFFFF"/>
  <gradient 
    android:angle="225"
    android:startColor="#DD2ECCFA"
    android:endColor="#DD000000"/>
<corners
    android:bottomLeftRadius="7dp"
    android:bottomRightRadius="7dp"
    android:topLeftRadius="7dp"
    android:topRightRadius="7dp" />
</shape>

and in myactivity.xml

you can use:

<Button
    android:id="@+id/btn_Shap"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:text="@string/Shape"
    android:background="@drawable/shape"/>
Comments