Tôi đã có sau bộ drawable làm nền LinearLayout:Radial Gradient Android
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap
android:tileMode="repeat"
android:dither="true"
android:src="@drawable/bg"/>
</item>
<item>
<shape android:shape="rectangle">
<gradient
android:startColor="#ffff0000"
android:endColor="#ff00ff00"
android:centerX="50%"
android:centerY="50%"
android:gradientRadius="50%"
android:type="radial"/>
</shape>
</item>
</layer-list>
Theo docs, gradientRadius có thể được thiết lập để tỷ lệ kích thước cửa sổ/mẹ. Unfortunetely ... nó không hoạt động. Bán kính là 0. Tôi đang làm gì sai? Hoặc có gì sai với Android?
Tôi cần có độ dốc xuyên tâm để lấp đầy toàn bộ màn hình. Cách giải quyết là gì?
tôi tham khảo bố cục và cũng để textview nó điền toàn bộ màn hình, tôi có thể bỏ lỡ hiểu những gì bạn cần –
Tôi chưa bao giờ có thể nhận được một giá trị không nguyên như gardientRadius. Tất cả các ví dụ tôi tìm thấy đều bằng pixel, thậm chí không bị nhúng. Để giải quyết sự cố, bạn có thể tạo mã có thể drawable và đặt bán kính sau khi đo chế độ xem. – yoah