本文整理汇总了Java中android.support.v4.preferencefragment.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
R类属于android.support.v4.preferencefragment包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureList
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
private void ensureList() {
if (mList != null) {
return;
}
View root = getView();
if (root == null) {
throw new IllegalStateException("Content view not yet created");
}
View rawListView = root.findViewById(android.R.id.list);
if (!(rawListView instanceof ListView)) {
throw new RuntimeException(
"Content has view with id attribute 'android.R.id.list' "
+ "that is not a ListView class");
}
mList = (ListView)rawListView;
if (mList == null) {
throw new RuntimeException(
"Your content must have a ListView whose id attribute is " +
"'android.R.id.list'");
}
mList.setOnKeyListener(mListOnKeyListener);
mHandler.post(mRequestFocus);
}
示例2: ensureList
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
private void ensureList() {
if (mList != null) {
return;
}
View root = getView();
if (root == null) {
throw new IllegalStateException("Content view not yet created");
}
View rawListView = root.findViewById(android.R.id.list);
if (!(rawListView instanceof ListView)) {
throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a ListView class");
}
mList = (ListView)rawListView;
if (mList == null) {
throw new RuntimeException("Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
}
mList.setOnKeyListener(mListOnKeyListener);
mHandler.post(mRequestFocus);
}
示例3: onSupportContentChanged
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
/**
* Updates the screen state (current list and other views) when the
* content changes.
*
* @see Activity#onContentChanged()
*/
public void onSupportContentChanged() {
super.onSupportContentChanged();
View emptyView = findViewById(android.R.id.empty);
mList = (ListView)findViewById(android.R.id.list);
if (mList == null) {
throw new RuntimeException(
"Your content must have a ListView whose id attribute is " +
"'android.R.id.list'");
}
if (emptyView != null) {
mList.setEmptyView(emptyView);
}
mList.setOnItemClickListener(mOnClickListener);
if (mFinishedStart) {
setListAdapter(mAdapter);
}
mHandler.post(mRequestFocus);
mFinishedStart = true;
}
示例4: resolveDialogTheme
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
static int resolveDialogTheme(Context context, int resid) {
// if (resid == THEME_TRADITIONAL) {
// return com.android.internal.R.style.Theme_Dialog_Alert;
// } else if (resid == THEME_HOLO_DARK) {
// return com.android.internal.R.style.Theme_Holo_Dialog_Alert;
// } else if (resid == THEME_HOLO_LIGHT) {
// return com.android.internal.R.style.Theme_Holo_Light_Dialog_Alert;
// } else if (resid == THEME_DEVICE_DEFAULT_DARK) {
// return com.android.internal.R.style.Theme_DeviceDefault_Dialog_Alert;
// } else if (resid == THEME_DEVICE_DEFAULT_LIGHT) {
// return com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog_Alert;
// } else if (resid >= 0x01000000) { // start of real resource IDs.
// return resid;
// } else {
TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.alertDialogTheme, outValue, true);
return outValue.resourceId;
// }
}
示例5: setupContent
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
private void setupContent(LinearLayout contentPanel) {
mScrollView = (ScrollView) mWindow.findViewById(R.id.scrollView);
mScrollView.setFocusable(false);
// Special case for users that only want to display a String
mMessageView = (TextView) mWindow.findViewById(R.id.message);
if (mMessageView == null) {
return;
}
if (mMessage != null) {
mMessageView.setText(mMessage);
} else {
mMessageView.setVisibility(View.GONE);
mScrollView.removeView(mMessageView);
if (mListView != null) {
contentPanel.removeView(mWindow.findViewById(R.id.scrollView));
contentPanel.addView(mListView,
new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
contentPanel.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
} else {
contentPanel.setVisibility(View.GONE);
}
}
}
示例6: PreferenceFrameLayout
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
public PreferenceFrameLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PreferenceFrameLayout,
defStyle, 0);
float density = context.getResources().getDisplayMetrics().density;
int defaultBorderTop = (int) (density * DEFAULT_BORDER_TOP + 0.5f);
int defaultBottomPadding = (int) (density * DEFAULT_BORDER_BOTTOM + 0.5f);
int defaultLeftPadding = (int) (density * DEFAULT_BORDER_LEFT + 0.5f);
int defaultRightPadding = (int) (density * DEFAULT_BORDER_RIGHT + 0.5f);
mBorderTop = a.getDimensionPixelSize(R.styleable.PreferenceFrameLayout_borderTop,
defaultBorderTop);
mBorderBottom = a.getDimensionPixelSize(R.styleable.PreferenceFrameLayout_borderBottom,
defaultBottomPadding);
mBorderLeft = a.getDimensionPixelSize(R.styleable.PreferenceFrameLayout_borderLeft,
defaultLeftPadding);
mBorderRight = a.getDimensionPixelSize(R.styleable.PreferenceFrameLayout_borderRight,
defaultRightPadding);
a.recycle();
}
示例7: ListPreference
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
public ListPreference(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ListPreference, 0, 0);
mEntries = a.getTextArray(R.styleable.ListPreference_entries);
mEntryValues = a.getTextArray(R.styleable.ListPreference_entryValues);
a.recycle();
/* Retrieve the Preference summary attribute since it's private
* in the Preference class.
*/
a = context.obtainStyledAttributes(attrs,
R.styleable.Preference, 0, 0);
mSummary = a.getString(R.styleable.Preference_summary);
a.recycle();
}
示例8: SwitchPreference
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
/**
* Construct a new SwitchPreference with the given style options.
*
* @param context The Context that will style this preference
* @param attrs Style attributes that differ from the default
* @param defStyle Theme attribute defining the default style options
*/
public SwitchPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.SwitchPreference, defStyle, 0);
setSummaryOn(a.getString(R.styleable.SwitchPreference_summaryOn));
setSummaryOff(a.getString(R.styleable.SwitchPreference_summaryOff));
setSwitchTextOn(a.getString(
R.styleable.SwitchPreference_switchTextOn));
setSwitchTextOff(a.getString(
R.styleable.SwitchPreference_switchTextOff));
setDisableDependentsState(a.getBoolean(
R.styleable.SwitchPreference_disableDependentsState, false));
a.recycle();
}
示例9: Switch2
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
/**
* Construct a new Switch with a default style determined by the given theme attribute,
* overriding specific style attributes as requested.
*
* @param context The Context that will determine this widget's theming.
* @param attrs Specification of attributes that should deviate from the default styling.
* @param defStyle An attribute ID within the active theme containing a reference to the
* default style for this widget. e.g. android.R.attr.switchStyle.
*/
public Switch2(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Switch, defStyle, 0);
mThumbDrawable = a.getDrawable(R.styleable.Switch_thumb);
mTrackDrawable = a.getDrawable(R.styleable.Switch_track);
mThumbTextPadding = a.getDimensionPixelSize(
R.styleable.Switch_thumbTextPadding, 0);
mSwitchMinWidth = a.getDimensionPixelSize(
R.styleable.Switch_switchMinWidth, 0);
mSwitchPadding = a.getDimensionPixelSize(
R.styleable.Switch_switchPadding, 0);
a.recycle();
ViewConfiguration config = ViewConfiguration.get(context);
mTouchSlop = config.getScaledTouchSlop();
mMinFlingVelocity = config.getScaledMinimumFlingVelocity();
// Refresh display with current params
refreshDrawableState();
setChecked(isChecked());
}
示例10: onBindDialogView
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
@Override
protected void onBindDialogView(View view) {
super.onBindDialogView(view);
mEditText = (EditText) view.findViewById(R.id.edit);
mEditText.setEnabled(true);
mEditText.setText(getText());
// EditText editText = mEditText;
// mEditText.setEnabled(true);
// editText.setText(getText());
//
// ViewParent oldParent = editText.getParent();
// if (oldParent != view) {
// if (oldParent != null) {
// ((ViewGroup) oldParent).removeView(editText);
// }
// onAddEditTextToDialogView(view, editText);
// }
}
示例11: onCreateView
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
/**
* Creates the View to be shown for this Preference in the
* {@link PreferenceActivity}. The default behavior is to inflate the main
* layout of this Preference (see {@link #setLayoutResource(int)}. If
* changing this behavior, please specify a {@link ViewGroup} with ID
* {@link android.R.id#widget_frame}.
* <p>
* Make sure to call through to the superclass's implementation.
*
* @param parent The parent that this View will eventually be attached to.
* @return The View that displays this Preference.
* @see #onBindView(View)
*/
protected View onCreateView(ViewGroup parent) {
final LayoutInflater layoutInflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View layout = layoutInflater.inflate(mLayoutResId, parent, false);
final ViewGroup widgetFrame = (ViewGroup) layout
.findViewById(R.id.widget_frame);
if (widgetFrame != null) {
if (mWidgetLayoutResId != 0) {
layoutInflater.inflate(mWidgetLayoutResId, widgetFrame);
} else {
widgetFrame.setVisibility(View.GONE);
}
}
return layout;
}
示例12: MultiCheckPreference
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
public MultiCheckPreference(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.ListPreference, 0, 0);
mEntries = a.getTextArray(R.styleable.ListPreference_entries);
if (mEntries != null) {
setEntries(mEntries);
}
setEntryValuesCS(a.getTextArray(
R.styleable.ListPreference_entryValues));
a.recycle();
/* Retrieve the Preference summary attribute since it's private
* in the Preference class.
*/
a = context.obtainStyledAttributes(attrs,
R.styleable.Preference, 0, 0);
mSummary = a.getString(R.styleable.Preference_summary);
a.recycle();
}
示例13: DialogPreference
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
public DialogPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.DialogPreference, defStyle, 0);
mDialogTitle = a.getString(R.styleable.DialogPreference_dialogTitle);
if (mDialogTitle == null) {
// Fallback on the regular title of the preference
// (the one that is seen in the list)
mDialogTitle = getTitle();
}
mDialogMessage = a.getString(R.styleable.DialogPreference_dialogMessage);
mDialogIcon = a.getDrawable(R.styleable.DialogPreference_dialogIcon);
mPositiveButtonText = a.getString(R.styleable.DialogPreference_positiveButtonText);
mNegativeButtonText = a.getString(R.styleable.DialogPreference_negativeButtonText);
mDialogLayoutResId = a.getResourceId(R.styleable.DialogPreference_dialogLayout,
mDialogLayoutResId);
a.recycle();
}
示例14: ensureList
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
private void ensureList() {
if (mList != null) {
return;
}
View root = getView();
if (root == null) {
throw new IllegalStateException("Content view not yet created");
}
View rawListView = root.findViewById(android.R.id.list);
if (!(rawListView instanceof ListView)) {
throw new RuntimeException(
"Content has view with id attribute 'android.R.id.list' "
+ "that is not a ListView class");
}
mList = (ListView) rawListView;
if (mList == null) {
throw new RuntimeException(
"Your content must have a ListView whose id attribute is " +
"'android.R.id.list'");
}
mList.setOnKeyListener(mListOnKeyListener);
mHandler.post(mRequestFocus);
}
示例15: ensureList
import android.support.v4.preferencefragment.R; //导入依赖的package包/类
private void ensureList() {
if (mList != null) return;
View root = getView();
if (root == null) throw new IllegalStateException("Content view not yet created");
View rawListView = root.findViewById(android.R.id.list);
if (!(rawListView instanceof ListView)) {
throw new RuntimeException(
"Content has view with id attribute 'android.R.id.list' "
+ "that is not a ListView class");
}
mList = (ListView) rawListView;
if (mList == null)
throw new RuntimeException("Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
mList.setOnKeyListener(mListOnKeyListener);
mHandler.post(mRequestFocus);
}