Java Code Examples for android.support.v4.app.ActivityCompat#getDrawable()

The following examples show how to use android.support.v4.app.ActivityCompat#getDrawable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseToolBar.java    From FileManager with Apache License 2.0 5 votes vote down vote up
public void setCenterDrawableRight(int ResId) {
    Drawable drawable = ActivityCompat.getDrawable(mContext, ResId);
    //要加这句才能显示
    drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
    centerView.setCompoundDrawables(null, null, drawable, null);
    centerView.setClickable(true);
}
 
Example 2
Source File: BaseToolBar.java    From FileManager with Apache License 2.0 5 votes vote down vote up
public void setRightDrawableRight(int ResId) {
    Drawable drawable = ActivityCompat.getDrawable(mContext, ResId);
    //要加这句才能显示
    drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
    rightView.setCompoundDrawables(null, null, drawable, null);
    rightView.setClickable(true);
}
 
Example 3
Source File: BaseToolBar.java    From FileManager with Apache License 2.0 5 votes vote down vote up
public void setLeftDrawableRight(int ResId) {
    Drawable drawable = ActivityCompat.getDrawable(mContext, ResId);
    //要加这句才能显示
    drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
    leftView.setCompoundDrawables(null, null, drawable, null);
    leftView.setClickable(true);
}
 
Example 4
Source File: DividerGridItemDecoration.java    From FileManager with Apache License 2.0 4 votes vote down vote up
public DividerGridItemDecoration(Context context) {
    mDivider = ActivityCompat.getDrawable(context, R.drawable.divider_bg);
}