`

如何构建背景渐变的页面

阅读更多
shape.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
	android:shape="rectangle">
	<gradient android:startColor="#FF123456" android:endColor="#FF654321"
		android:angle="270" />
</shape>


style.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<style name="NewTheme" parent="android:Theme">
		<item name="android:background">@drawable/shape</item>
	</style>
</resources>



配置文件:
<activity android:name=".translucent" android:label="@string/app_name"
			android:theme="@style/NewTheme">

这样就可以看到效果了,通过自定义startColor,endColor值就可以了...
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics