Android examples for User Interface:View Background
Retrieve the selectable background of the current style for View.
//package com.java2s; import android.content.Context; import android.content.res.TypedArray; import android.util.TypedValue; public class Main { /**/* w w w. java 2 s . co m*/ * Retrieve the selectable background of the current style. * * @param context context used to retrieve the styled attributes. * @return selectable item background res id. */ public static int getSelectableItemBackground(Context context) { int selectableItemBackgroundResId; int[] attrs = new int[] { android.R.attr.selectableItemBackground }; TypedValue values = new TypedValue(); TypedArray array = context.obtainStyledAttributes(values.data, attrs); selectableItemBackgroundResId = array.getResourceId(0, 0); array.recycle(); return selectableItemBackgroundResId; } }