У меня есть простой файл макета, для которого я хочу использовать рисование в фоновом режиме основного контейнера
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mlv_balance_detail_container"
android:layout_height="wrap_content"
android:orientation="vertical"
**android:background="@drawable/sample_drawable"** //this was causing crash in 4.4.2 API 19
android:padding="@dimen/dimen_16dp">
<TextView
android:id="@+id/tv_policy_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:letterSpacing="0.04"
tools:text="text"
android:textColor="#1d252d"
android:textSize="14sp"
android:textStyle="normal" />
<TextView
android:id="@+id/tv_total_balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_policy_text"
android:layout_marginTop="8dp"
android:fontFamily="sans-serif"
android:letterSpacing="0.04"
tools:text="some text"
android:textColor="#1d252d"
android:textSize="12sp"
android:textStyle="normal" />
</RelativeLayout>
Затем я попытался установить фон из кода, используя
container.setBackground(ContextCompat.getDrawable(context, R.drawable.sample_drawable));
Он все еще вылетает, может ли кто-нибудь мне помочь? Спасибо,