Xin chào Tôi đang cố gắng tạo nền drawable
cho màn hình giật gân mà tôi sẽ đặt trong chính chủ đề đó. Nhưng bitmap drawable được sử dụng để giữ ở trung tâm là nhận được kéo dài và tôi không thể tìm cách để giữ cho nó bình thường. Dưới đây là mã drawable của tôi: splash_screen_bg.xmltạo nền có thể vẽ bằng cách sử dụng danh sách lớp, biểu tượng bị kéo dài
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="360"
android:centerColor="@color/colorAccentXDark"
android:endColor="@color/Black"
android:gradientRadius="500dp"
android:startColor="@color/colorAccentXDark"
android:type="radial"
android:useLevel="false" />
</shape>
</item>
<item
android:bottom="50dp"
android:top="50dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="500dp"
android:innerRadiusRatio="1"
android:shape="oval">
<gradient
android:angle="360"
android:centerColor="@color/colorAccentXDark"
android:endColor="@color/colorAccentXDark"
android:gradientRadius="400dp"
android:startColor="@color/colorAccent"
android:type="radial"
android:useLevel="false" />
</shape>
</item>
<item android:gravity="center">
<bitmap android:src="@drawable/ty_logo" />
</item>
</layer-list>
Đây là mã nơi tôi đang thiết drawable này làm nền của một hoạt động:
<style name="TYTheme" parent="SearchActivityTheme.NoActionBar">
<item name="colorPrimaryDark">@color/colorAccentXDark</item>
<item name="android:alertDialogTheme">@style/AlertDialogTheme</item>
<item name="android:windowBackground">@drawable/splash_screen_bg</item>
</style>
Vì vậy, đây bitmap drawable ty_logo
là một png
đang bị kéo căng trong điện thoại của tôi. Vì không có tùy chọn scaleType
với bitmapDrawable
Tôi không biết cách xử lý.
Bạn có tìm thấy câu trả lời nào cho câu hỏi này không? Tôi có cùng một vấn đề ngay bây giờ và không thể tìm thấy một giải pháp. – baal
chưa nhận được giải pháp. – himanshu1496