我想創建一個從內部到外部的背景漸變。而在外面,它應該變得越來越黑。以下是圖像:Android矩形背景漸變
任何人都可以給我一些意見,我怎麼可以創建類似的東西? 或者我應該爲此拍照嗎?如果是的話,不同的屏幕分辨率有什麼關係?或關於風景/人像模式?
我想創建一個從內部到外部的背景漸變。而在外面,它應該變得越來越黑。以下是圖像:Android矩形背景漸變
任何人都可以給我一些意見,我怎麼可以創建類似的東西? 或者我應該爲此拍照嗎?如果是的話,不同的屏幕分辨率有什麼關係?或關於風景/人像模式?
你想怎麼樣cardview是什麼呢?或者,你可以用這個也試試,
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<gradient
android:angle="360"
android:centerColor="#e95a22"
android:endColor="#ff00b5"
android:gradientRadius="360"
android:startColor="#006386"
android:type="sweep" />
<stroke
android:width="2dp"
android:color="#ff207d94" />
</shape>
</item>
<item
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp">
<shape android:shape="rectangle" >
<solid android:color="#fff" />
</shape>
</item>
</layer-list>
是的,你可以使用nine patch image來實現這種類型的gredient
但如果你想使用gredient然後我認爲這將是對你幫助..
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="radial"
android:centerX="50%"
android:centerY="50%"
android:startColor="#FFff0000"
android:endColor="#FF000000"
android:gradientRadius="100"/>
</shape>
和this是olnline工具,您可以創建gredient,您可以使用androi搶碼d標籤..
如果你正在使用九個補丁圖像,那麼當你一次旋轉你的屏幕時,它可能是一些問題,但如果你使用的是XML文件,它永遠不會產生問題..所以按照我的觀點,你必須使用這個功能來實現漸變(.xml)文件。 @MyNewName –
使用這種顏色的變化要求
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient
android:type="radial"
android:startColor="#f15330"
android:endColor="#da0000"
android:gradientRadius="150dp"
/>
<size android:height="400dp"
android:width="250dp"/>
</shape>
如果您採用九張補丁圖像,然後當你在一個時間旋轉你的屏幕也可以是一些問題,但如果你使用XML文件它會從來沒有創建問題..根據我的觀點,你必須使用漸變(.xml)文件來實現這個功能。 @MyNewName –