本文整理汇总了Java中android.view.View.NO_ID属性的典型用法代码示例。如果您正苦于以下问题:Java View.NO_ID属性的具体用法?Java View.NO_ID怎么用?Java View.NO_ID使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.View
的用法示例。
在下文中一共展示了View.NO_ID属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onChildViewAdded
/**
* {@inheritDoc}
*/
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public void onChildViewAdded(View parent, View child) {
if (parent == RelativeRadioGroup.this && child instanceof RadioButton) {
int id = child.getId();
// generates an id if it's missing
if (id == View.NO_ID) {
id = View.generateViewId();
child.setId(id);
}
((RadioButton) child).setOnCheckedChangeListener(mChildOnCheckedChangeListener);
}
if (mOnHierarchyChangeListener != null) {
mOnHierarchyChangeListener.onChildViewAdded(parent, child);
}
}
示例2: RelativeRadioGroup
/**
* {@inheritDoc}
*/
public RelativeRadioGroup(Context context, AttributeSet attrs) {
super(context, attrs);
// retrieve selected radio button as requested by the user in the
// XML layout file
TypedArray attributes = context.obtainStyledAttributes(
attrs, R.styleable.RelativeRadioGroup, 0, 0);
int value = attributes.getResourceId(R.styleable.RelativeRadioGroup_checkedButton, View.NO_ID);
if (value != View.NO_ID) {
mCheckedId = value;
}
attributes.recycle();
init();
}
示例3: onFinishInflate
@Override
protected void onFinishInflate() {
super.onFinishInflate();
if (null != mContentView) {
return;
}
if (View.NO_ID != contentLayoutId) {
mContentView = findViewById(contentLayoutId);
return;
}
for (int i = 0; i < getChildCount(); i++) {//判断是否是addView进来的,不是的话默认其为首选的View,就可以不设置contentLayoutId了,如果没有就抛异常
View v = getChildAt(i);
if (v.equals(mLeftView) || v.equals(mTopView) || v.equals(mRightView) || v.equals(mBottomView)) {
continue;
}
mContentView = v;
return;
}
throw new IllegalStateException("请为OverScrollLayout添加contentLayoutId属性,以索引目标View");
}
示例4: addView
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
if (child instanceof CompoundButton) {
final CompoundButton button = (CompoundButton) child;
if (button.isChecked()) {
mProtectFromCheckedChange = true;
int currentCheck = getExclusiveCheckedId();
if (mExclusive && currentCheck != View.NO_ID) {
setCheckedStateForView(currentCheck, false);
}
mProtectFromCheckedChange = false;
addCheckedId(button.getId());
}
}
super.addView(child, index, params);
}
示例5: saveActionViewStates
public void saveActionViewStates(Bundle outStates) {
SparseArray<Parcelable> viewStates = null;
final int itemCount = size();
for (int i = 0; i < itemCount; i++) {
final MenuItem item = getItem(i);
final View v = item.getActionView();
if (v != null && v.getId() != View.NO_ID) {
if (viewStates == null) {
viewStates = new SparseArray<Parcelable>();
}
v.saveHierarchyState(viewStates);
if (item.isActionViewExpanded()) {
outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId());
}
}
if (item.hasSubMenu()) {
final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
subMenu.saveActionViewStates(outStates);
}
}
if (viewStates != null) {
outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates);
}
}
示例6: createAccessibilityNodeInfo
@Override
public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
switch (virtualViewId) {
case View.NO_ID:
return createAccessibilityNodeInfoForNumberPicker( getScrollX(), getScrollY(),
getScrollX() + (getRight() - getLeft()), getScrollY() + (getBottom() - getTop()));
case VIRTUAL_VIEW_ID_DECREMENT:
return createAccessibilityNodeInfoForVirtualButton(VIRTUAL_VIEW_ID_DECREMENT,
getVirtualDecrementButtonText(), getScrollX(), getScrollY(),
getScrollX() + (getRight() - getLeft()),
mTopSelectionDividerTop + mSelectionDividerHeight);
case VIRTUAL_VIEW_ID_INPUT:
return createAccessibiltyNodeInfoForInputText();
case VIRTUAL_VIEW_ID_INCREMENT:
return createAccessibilityNodeInfoForVirtualButton(VIRTUAL_VIEW_ID_INCREMENT,
getVirtualIncrementButtonText(), getScrollX(),
mBottomSelectionDividerBottom - mSelectionDividerHeight,
getScrollX() + (getRight() - getLeft()), getScrollY() + (getBottom() - getTop()));
}
return super.createAccessibilityNodeInfo(virtualViewId);
}
示例7: startUpdate
@Override
public void startUpdate(ViewGroup container) {
if (container.getId() == View.NO_ID) {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}
示例8: onFinishInflate
/**
* {@inheritDoc}
*/
@Override
protected void onFinishInflate() {
super.onFinishInflate();
// checks the appropriate radio button as requested in the XML file
int initialCheck = getExclusiveCheckedId();
if (initialCheck != View.NO_ID) {
mProtectFromCheckedChange = true;
setCheckedStateForView(initialCheck, true);
mProtectFromCheckedChange = false;
addCheckedId(initialCheck);
}
}
示例9: setup
public void setup(Context context, FragmentManager manager, int containerId) {
ensureHierarchy(context); // Ensure views required by super.setup()
super.setup();
mContext = context;
mFragmentManager = manager;
mContainerId = containerId;
ensureContent();
mRealTabContent.setId(containerId);
// We must have an ID to be able to save/restore our state. If
// the owner hasn't set one at this point, we will set it ourself.
if (getId() == View.NO_ID) {
setId(android.R.id.tabhost);
}
}
示例10: setup
public void setup(final Context context, final FragmentManager manager,
final int containerId) {
super.setup();
mContext = context;
mFragmentManager = manager;
mContainerId = containerId;
ensureContent();
mRealTabContent.setId(containerId);
// We must have an ID to be able to save/restore our state. If
// the owner hasn't set one at this point, we will set it ourself.
if (getId() == View.NO_ID) {
setId(android.R.id.tabhost);
}
}
示例11: findAccessibilityNodeInfosByText
@Override
public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String searched,
int virtualViewId) {
if (TextUtils.isEmpty(searched)) {
return Collections.emptyList();
}
String searchedLowerCase = searched.toLowerCase();
List<AccessibilityNodeInfo> result = new ArrayList<AccessibilityNodeInfo>();
switch (virtualViewId) {
case View.NO_ID: {
findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
VIRTUAL_VIEW_ID_DECREMENT, result);
findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
VIRTUAL_VIEW_ID_INPUT, result);
findAccessibilityNodeInfosByTextInChild(searchedLowerCase,
VIRTUAL_VIEW_ID_INCREMENT, result);
return result;
}
case VIRTUAL_VIEW_ID_DECREMENT:
case VIRTUAL_VIEW_ID_INCREMENT:
case VIRTUAL_VIEW_ID_INPUT: {
findAccessibilityNodeInfosByTextInChild(searchedLowerCase, virtualViewId,
result);
return result;
}
}
return super.findAccessibilityNodeInfosByText(searched, virtualViewId);
}
示例12: SwipeDrawerLayout
public SwipeDrawerLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mViewDragHelper = ViewDragHelper.create(this, 1.0f, new ViewDragHelperCallback());
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SwipeToRefreshLayout);
contentLayoutId = ta.getResourceId(R.styleable.SwipeToRefreshLayout_contentLayoutId, View.NO_ID);
int leftLayoutId = ta.getResourceId(R.styleable.SwipeToRefreshLayout_leftView, View.NO_ID);
int topLayoutId = ta.getResourceId(R.styleable.SwipeToRefreshLayout_topView, View.NO_ID);
int rightLayoutId = ta.getResourceId(R.styleable.SwipeToRefreshLayout_rightView, View.NO_ID);
int bottomLayoutId = ta.getResourceId(R.styleable.SwipeToRefreshLayout_bottomView, View.NO_ID);
mDirectionMask = ta.getInt(R.styleable.SwipeToRefreshLayout_swipeDirection, mDirectionMask);
mFactor = ta.getFloat(R.styleable.SwipeToRefreshLayout_horizontalRangeFactor, 0.3f);
ta.recycle();
LayoutInflater inflater = LayoutInflater.from(context);
if (View.NO_ID != leftLayoutId) {
mLeftView = inflater.inflate(leftLayoutId, this, false);
addView(mLeftView);
}
if (View.NO_ID != topLayoutId) {
mTopView = inflater.inflate(topLayoutId, this, false);
addView(mTopView);
}
if (View.NO_ID != rightLayoutId) {
mRightView = inflater.inflate(rightLayoutId, this, false);
addView(mRightView);
}
if (View.NO_ID != bottomLayoutId) {
mBottomView = inflater.inflate(bottomLayoutId, this, false);
addView(mBottomView);
}
enableSwipe = true;
}
示例13: setActionView
public MenuItem setActionView(View view) {
mActionView = view;
mActionProvider = null;
if (view != null && view.getId() == View.NO_ID && mId > 0) {
view.setId(mId);
}
mMenu.onItemActionRequestChanged(this);
return this;
}
示例14: startUpdate
@Override
public void startUpdate(ViewGroup container) {
if (container.getId() == View.NO_ID) {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}
示例15: init
private void init() {
mCheckedId = View.NO_ID;
mChildOnCheckedChangeListener = new CheckedStateTracker();
mPassThroughListener = new PassThroughHierarchyChangeListener();
super.setOnHierarchyChangeListener(mPassThroughListener);
}