当前位置: 首页>>代码示例>>Java>>正文


Java View.NO_ID属性代码示例

本文整理汇总了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);
    }
}
 
开发者ID:mmb4rn0,项目名称:RelativeRadioGroup,代码行数:19,代码来源:RelativeRadioGroup.java

示例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();
}
 
开发者ID:mmb4rn0,项目名称:RelativeRadioGroup,代码行数:19,代码来源:RelativeRadioGroup.java

示例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");
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeToRefreshLayout,代码行数:20,代码来源:OverScrollLayout.java

示例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);
}
 
开发者ID:rcketscientist,项目名称:ToggleButtons,代码行数:17,代码来源:ToggleGroup.java

示例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);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:26,代码来源:MenuBuilder.java

示例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);
}
 
开发者ID:helenepang,项目名称:LimitedDatePicker,代码行数:21,代码来源:NumberPicker.java

示例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");
    }
}
 
开发者ID:yangjiantao,项目名称:AndroidUiKit,代码行数:7,代码来源:TabPagerAdapter.java

示例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);
      }
  }
 
开发者ID:rcketscientist,项目名称:ToggleButtons,代码行数:16,代码来源:ToggleGroup.java

示例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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:FragmentTabHost.java

示例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);
	}
}
 
开发者ID:CactusSoft,项目名称:zabbkit-android,代码行数:15,代码来源:FixedFragmentTabHost.java

示例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);
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:28,代码来源:NumberPicker.java

示例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;
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeToRefreshLayout,代码行数:34,代码来源:SwipeDrawerLayout.java

示例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;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:9,代码来源:MenuItemImpl.java

示例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");
  }
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:7,代码来源:FragmentStatePagerAdapter.java

示例15: init

private void init() {
    mCheckedId = View.NO_ID;
    mChildOnCheckedChangeListener = new CheckedStateTracker();
    mPassThroughListener = new PassThroughHierarchyChangeListener();
    super.setOnHierarchyChangeListener(mPassThroughListener);
}
 
开发者ID:RealMoMo,项目名称:NestRadioGroup,代码行数:6,代码来源:NestRadioGroup.java


注:本文中的android.view.View.NO_ID属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。