<TextView
android:id=“@+id/tvshadow”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:textSize=“60sp”
android:textColor=“#ffffffff”
android:layout_gravity=“center”
android:text=“Test Shadow”
android:shadowColor=“#ff000000”
android:shadowRadius=“10”
android:shadowDx=“10”
android:shadowDy=“10”
/>
需要注意的是,这几个参数只对TextView控件有效,其它的控件比如ImageView和布局控件如LinearLayout则无效。
如果需要让布局控件比如LinearLayout有阴影效果怎么办呢?
解决方案就是:制作带有阴影效果的9png图片作为背景图片。