XML 파일 :android : drawableBottom 특성과 함께 사용할 경우 그리기 모양이 표시되지 않습니다. 고해상도/드로어 블/사진 gradient_box.xml에 저장
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#FFFF0000"
android:endColor="#80FF00FF"
android:angle="45"/>
<padding android:left="7dp"
android:top="7dp"
android:right="7dp"
android:bottom="7dp" />
<corners android:radius="8dp" />
</shape>
(위의 모양의 정의는 다음 안드로이드 개발자 가이드에서 가져되고 거기에 오류가 없습니다..).
은의이 텍스트 뷰와 함께 사용 해보자 :
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Text with some crazy rectangle shape below it."
android:drawableBottom="@drawable/gradient_box"/>
텍스트 뷰의 표시 drawableBottom 속성이없는 것처럼! 그러나, 배경과 형상을 설정하면 잘 작동 : 안드로이드에 실제 이미지 (예를 들어, *의 .PNG)를 설정
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Text with crazy background"
android:background="@drawable/gradient_box"/>
: drawableBottom도 잘 작동한다.
아이디어가 있으십니까?
그런 경우 match_parent 너비를 설정할 수 없습니다. –
그라데이션 드로잉 설정은 프로그래밍 방식으로 설정했을 때 효과적입니다 (예 : https://stackoverflow.com/questions/8481322/create-a-radial-gradient-programmatically). – foo