是否可以使用android:DrawableRight在Button和TextViews中使用VectorDrawable?
当我在textview或imageview中使用VectorDrawable资产时,使用“ android:DrawableRight” /“ android:DrawableEnd” /“ android:DrawableStart” /“ android:DrawableLeft”时出现运行时崩溃。 该应用程序将编译正常,没有任何警告。 我在用 摇篮1.5 支持库23.2('com.android.support:appcompat-v7:23.2.0') 不过,我发现我可以以编程方式在Java中分配SVG,而不会发生此类崩溃。 TextView tv = (TextView) findViewById(R.id.textView); tv.setCompoundDrawablesWithIntrinsicBounds(null,null, getResources().getDrawable(R.drawable.ic_accessible_white_36px),null); (我怀疑这是23.2的支持库错误。) 但是是否可以对SVG资产使用drawableRight等? 这是我的布局 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="au.com.angryitguy.testsvg.MainActivity"> <TextView android:id="@+id/textView" android:layout_width="match_parent" android:layout_height="wrap_content" android:drawableRight="@drawable/ic_accessible_white_36px" android:background="@color/colorPrimary" android:textColor="#FFFFFF" android:textSize="22sp" android:text="Hello World!"/> </RelativeLayout> 这是我的活动 package au.com.angryitguy.testsvg; …