在操作过程中想要动态改变button的drawableTop属性
通过button的setCompoundDrawables方法来设置,不过在设置Drawable对象的时候需要调用setBounds方法设置一下
<Button
android:id="@+id/btn1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:drawableTop="@drawable/home_active"
android:onClick="show"
android:text="首页"
android:textColor="#00FFFF"
/>
// Two = getResources().getDrawable(R.drawable.star_active);
// Two.setBounds(0, 0, Two.getMinimumWidth(),Two.getMinimumHeight());
// btn2.setCompoundDrawables(null, Two, null, null);
方向 左上右下