Android-studio-material-template
Android-studio-material-template copied to clipboard
support froyo ?
Is it possible to support Android 2.2 (level 8)?
drawer_row.xml uses
android:background="?android:attr/selectableItemBackground"
which requires level 11 rather than 8
If that's the only thing that requires 11 you can simple remove it. That's used for ripple effect on latter android versions.
yeah ok, the NavigationDrawerAdapter needs the to be updated as follows:
public ViewHolder(View itemView) {
super(itemView);
textView = (TextView) itemView.findViewById(R.id.item_name);
if (Build.VERSION.SDK_INT >= 11) {
textView.setBackgroundDrawable(Utils.getDrawableFromAttr(context,
R.attr.selectableItemBackground));
}
}
/**
*
* @param context
* @param resId the R.attr id
* @return
*/
public static Drawable getDrawableFromAttr(Context context, int resId) {
int[] attrs = new int[]{resId};
TypedArray ta = context.getTheme().obtainStyledAttributes(attrs);
Drawable drawableFromTheme = ta.getDrawable(0);
ta.recycle();
return drawableFromTheme;
}