android:shadowColor 阴影颜色
android:shadowDx 阴影的水平偏移量
android:shadowDy 阴影的垂直偏移量
android:shadowRadius 阴影的范围
大多数情况下,某一类的TextView控件需要统一的风格,如加阴影等,那么可以使用style
Main.xml 代码
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView style="@style/StyleBarTitle"
android:id="@+id/txBarTitle1"
android:text="资讯行情" />
</AbsoluteLayout>
style.xml
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="StyleBarTitle">
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">20dp</item>
<item name="android:textColor">#81A147</item>
<item name="android:shadowColor">#ff0000</item>
<item name="android:shadowDx">2</item>
<item name="android:shadowDy">2</item>
<item name="android:shadowRadius">1</item>
<item name="android:background">@null</item>
</style>
</resources>
cs 代码:
using System; using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS; namespace AndroidApplication3
{
[Activity(Label = "AndroidApplication3", MainLauncher = true, Icon = "@drawable/icon")]
public class Activity1 : Activity
{ protected override void OnCreate(Bundle bundle)
{ base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
} }
}