2012-08-01 7 views
0

파일에서 비트 맵을 얻었으므로 그 주위에 그라디언트를 그릴 수 있어야합니다 (점차 투명 해짐). 나는 이것에 대해 어떻게 갈 것인가? 나는 주변을 둘러 보았고 많이 찾지 못했습니다.그라데이션 투명한 원 주위에 비트 맵을 그립니다.

오른쪽에 직접적인 도움을 주시면 감사하겠습니다. 내가 프로그래밍 방식으로이 작업을 수행하고 싶습니다

-Edit-

는 비트 맵 클래스와 캔버스 말한다.

나는 내 문제를 보여주는 그림을 그렸습니다. (여전히 고착 된 상태) : http://imgur.com/zfDOC

답변

1

xml로 지정할 수 있습니다.

<?xml version="1.0" encoding="UTF-8"?> 

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > 

    <item> 
     <shape android:shape="rectangle" > 

      <!-- end colour at top, start colour at bottom --> 
      <!-- Your colors can include hex alpha values --> 
      <!-- #ff000000 is fully transparent black --> 
      <!-- #00000000 is non transparent black --> 
      <!-- There are more options in that link to control the gradient more --> 
      <gradient 
       android:type="radial" 
       android:endColor="@color/endColor" 
       android:startColor="@color/startColor"/> 

     </shape> 

    </item> 

    <!-- top, bottom left and right adds padding --> 
    <item android:bottom="3px"> 
     <Bitmap src="@drawable/yourBitmap /> 
    </item> 
</layer-list> 

다음은 xml 드로어 블에 대한 자세한 정보와 훌륭한 링크입니다. http://idunnolol.com/android/drawables.html

+0

클래스 중간에 어떻게 구현하나요? XML에 대한 액세스 권한이 없다고 가정 해보십시오. –

+0

귀하의 초기 질문에이를 명시해야합니다. Java 객체에 매핑이 무엇인지 알려주는 링크를 사용하십시오. 비트 맵 아래에 그라데이션 배경이있는 LayerList를 만드는 것뿐입니다. 모든 XML 태그에는 Java 객체가 연결되어 있습니다. –

+0

어떻게 구현해야할지 모르겠다. 자바 코드 (객체 등)로 내 앱을 다 만들었다. –

관련 문제