2012-05-31 9 views
1

드로어 블을 사용하여 바깥쪽으로 방사되는 흰색 흐림 효과가있는 검은 색 배경을 만들 수 있습니까?Android - 불투명 페이드 드로어 블

여기 최종 제품이 될 것이며 장비가 ImageViwe이고 텍스트가 TextView 인 반면 검정색 + 흰색 흐림 효과를 하나의 드로어 블로 만들고 싶습니다. 함유의 LinearLayout : 여기

enter image description here

은 (최후의 GridView에 사용)을 배치하기위한 코드이다. 나는 가능하면 상기 드로어 블에있는 LinearLayout의 배경을 설정할 수 싶습니다

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_margin="10dp" 
    android:background="#000000" 
    android:gravity="center_vertical|center_horizontal" 
    android:orientation="vertical" 
    android:padding="5dp" > 

    <ImageView 
     android:id="@+id/tile_image" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:adjustViewBounds="true" 
     android:contentDescription="@string/temp_image" 
     android:src="@drawable/ic_logo" /> 

    <TextView 
     android:id="@+id/tile_title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

</LinearLayout> 

답변

9

물론이고, 다음은 방사형 그라데이션 그리기 가능하며 배경으로 사용됩니다. 원하는 효과를 얻으려면 색상/그라데이션 반경을 변경하십시오.

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"  
     android:shape="rectangle"> 
<gradient 
    android:startColor="#FFFFFFFF" 
    android:endColor="#00FFFFFF" 
    android:gradientRadius="270" 
    android:type="radial"/> 

</shape> 

은있는 LinearLayout에 다음 줄을 사용하여 적용 ("radialbg"당김 폴더에 XML 파일을 만들거나하는 당신이 선호하는 이름)

android:background="@drawable/radialbg"> 
관련 문제