當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。