how to set shadow to a View in android? -
i want know how add shadow layer general view in android. eg: suppose have layout xml, showing this..
<?xml version="1.0" encoding="utf-8"?> <linearlayout android:layout_height="wrap_content" android:layout_width="wrap_content" <button.... ... </linearlayout>
now when displayed want have shadow around it.
there simple trick, using 2 views form shadow.
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:background="#cc55cc"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <tablelayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchcolumns="0"> <tablerow> <linearlayout android:id="@+id/content" android:layout_width="wrap_content" android:layout_height="wrap_content"> <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#ffffff" android:text="@string/hello" /> </linearlayout> <view android:layout_width="5dp" android:layout_height="fill_parent" android:layout_margintop="5dp" android:background="#55000000"/> </tablerow> </tablelayout> <view android:layout_width="fill_parent" android:layout_height="5dp" android:layout_marginleft="5dp" android:background="#55000000"/> </linearlayout> </framelayout>
hope help.
Comments
Post a Comment