當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewGroup.getId方法代碼示例

本文整理匯總了Java中android.view.ViewGroup.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewGroup.getId方法的具體用法?Java ViewGroup.getId怎麽用?Java ViewGroup.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.getId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startUpdate

import android.view.ViewGroup; //導入方法依賴的package包/類
@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,代碼行數:8,代碼來源:FragmentStatePagerAdapter.java

示例2: startUpdate

import android.view.ViewGroup; //導入方法依賴的package包/類
@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,代碼行數:8,代碼來源:TabPagerAdapter.java

示例3: add

import android.view.ViewGroup; //導入方法依賴的package包/類
/**
 * Adds a new view onto the stack. This will add it to the container specified. Only containers that
 * are lower or equal position in the view hierarchy as the default container are allowed.
 * Views that aren't at the top of the stack will non-clickable.
 * @param viewCreator The view creator for the new view
 * @param container The container to add the view to
 */
public void add(ViewCreator viewCreator, ViewGroup container){
    if (container.getId() == -1){
        throw new RuntimeException("Container must have an id set");
    }
    if (!s.allowDuplicates && checkForDuplicates(viewCreator)){
        return;
    }

    BackStackNode backStackNode = new BackStackNode(viewCreator, container.getId());
    final ViewGroup tempView = currentView;
    final BackStackNode tempNode = s.nodeStack.peek();

    disable(tempView);
    s.nodeStack.add(backStackNode);
    currentView = addView(backStackNode);
    removeView(tempNode, tempView);
}
 
開發者ID:kevinwang5658,項目名稱:backstack,代碼行數:25,代碼來源:LinearBackStack.java

示例4: buildLinearBackStack

import android.view.ViewGroup; //導入方法依賴的package包/類
private LinearBackStack buildLinearBackStack(String TAG, ViewGroup container, ViewGroup currentView, ViewCreator viewCreator, boolean shouldRetain, boolean allowDuplicates){
    LinearBackStack.State state = linearStateMap.get(TAG);
    if (state == null){
        BackStackNode backStackNode = new BackStackNode(viewCreator, container.getId(), shouldRetain);
        state = new LinearBackStack.State(TAG, backStackNode);
        state.allowDuplicates = allowDuplicates;
        linearStateMap.put(TAG, state);
        //
    }

    LinearBackStack linearBackStack = new LinearBackStack(state, container, activity);
    if (currentView == null){
        linearBackStack.init();
    } else {
        if (state.nodeStack.size() != 1 && !shouldRetain){
            container.removeView(currentView);
        }
        linearBackStack.initWithoutFirst(currentView);
    }
    backStackMap.put(TAG, linearBackStack);
    setDefaultRootBackStack(TAG);

    return linearBackStack;
}
 
開發者ID:kevinwang5658,項目名稱:backstack,代碼行數:25,代碼來源:BackStackManager.java

示例5: findTargetTagAndCoordinatesForTouch

import android.view.ViewGroup; //導入方法依賴的package包/類
/**
 * Find touch event target view within the provided container given the coordinates provided
 * via {@link MotionEvent}.
 *
 * @param eventX the X screen coordinate of the touch location
 * @param eventY the Y screen coordinate of the touch location
 * @param viewGroup the container view to traverse
 * @param viewCoords an out parameter that will return the X,Y value in the target view
 * @param nativeViewTag an out parameter that will return the native view id
 * @return the react tag ID of the child view that should handle the event
 */
public static int findTargetTagAndCoordinatesForTouch(
    float eventX,
    float eventY,
    ViewGroup viewGroup,
    float[] viewCoords,
    @Nullable int[] nativeViewTag) {
  UiThreadUtil.assertOnUiThread();
  int targetTag = viewGroup.getId();
  // Store eventCoords in array so that they are modified to be relative to the targetView found.
  viewCoords[0] = eventX;
  viewCoords[1] = eventY;
  View nativeTargetView = findTouchTargetView(viewCoords, viewGroup);
  if (nativeTargetView != null) {
    View reactTargetView = findClosestReactAncestor(nativeTargetView);
    if (reactTargetView != null) {
      if (nativeViewTag != null) {
        nativeViewTag[0] = reactTargetView.getId();
      }
      targetTag = getTouchTargetForView(reactTargetView, viewCoords[0], viewCoords[1]);
    }
  }
  return targetTag;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:35,代碼來源:TouchTargetHelper.java

示例6: onItemClicked

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public void onItemClicked(ViewGroup parent, View view, int position) {
    switch (parent.getId()) {
        case R.id.recycler_view_similar:
            Media media = mSimilarList.get(position);
            if (media != null && getActivity() != null && getActivity().getSupportFragmentManager() != null) {
                getActivity().getSupportFragmentManager()
                        .beginTransaction()
                        .replace(R.id.layout_outlet, TVShowDetailsFragment.newInstance(media.getId(), media.getName()))
                        .commit();
                mCallbacks.scrollToTop();
            }
            break;
        case R.id.recycler_view_seasons:
            //TODO: Handle this in future release
            break;
    }
}
 
開發者ID:scaffeinate,項目名稱:Inflix,代碼行數:19,代碼來源:TVShowDetailsFragment.java

示例7: addRootViewGroup

import android.view.ViewGroup; //導入方法依賴的package包/類
protected final void addRootViewGroup(
    int tag,
    ViewGroup view,
    ThemedReactContext themedContext) {
  UiThreadUtil.assertOnUiThread();
  if (view.getId() != View.NO_ID) {
    throw new IllegalViewOperationException(
        "Trying to add a root view with an explicit id already set. React Native uses " +
        "the id field to track react tags and will overwrite this field. If that is fine, " +
        "explicitly overwrite the id field to View.NO_ID before calling addMeasuredRootView.");
  }

  mTagsToViews.put(tag, view);
  mTagsToViewManagers.put(tag, mRootViewManager);
  mRootTags.put(tag, true);
  view.setId(tag);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:18,代碼來源:NativeViewHierarchyManager.java

示例8: startUpdate

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public void startUpdate(@NonNull ViewGroup container) {
    if (container.getId() == View.NO_ID) {
        throw new IllegalStateException("ViewPager with adapter " + this
                + " requires a view id");
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:UpdatableFragmentPagerAdapter.java

示例9: findContentLayout

import android.view.ViewGroup; //導入方法依賴的package包/類
private ViewGroup findContentLayout(ViewGroup parent) {
    if (parent == null) {
        return null;
    }
    if (parent.getId() != android.R.id.content) {
        return findContentLayout((ViewGroup) parent.getParent());
    } else {
        return parent;
    }
}
 
開發者ID:halohoop,項目名稱:AndroidDigIn,代碼行數:11,代碼來源:DragViewGroup.java

示例10: instantiateItem

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
    if (currTransaction == null) {
        currTransaction = fm.beginTransaction();
    }

    Fragment fragment = getExistingFragment(position);

    if (fragment != null) {
        if (fragment.getId() == container.getId()) {
            retentionStrategy.attach(fragment, currTransaction);
        } else {
            fm.beginTransaction().remove(fragment).commit();
            fm.executePendingTransactions();

            currTransaction.add(container.getId(), fragment,
                    getFragmentTag(position));
        }
    } else {
        fragment = createFragment(entries.get(position).getDescriptor());
        currTransaction.add(container.getId(), fragment,
                getFragmentTag(position));
    }

    if (fragment != currPrimaryItem) {
        fragment.setMenuVisibility(false);
        fragment.setUserVisibleHint(false);
    }

    return fragment;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:32,代碼來源:ArrayPagerAdapter.java

示例11: setContainer

import android.view.ViewGroup; //導入方法依賴的package包/類
/**
 * Sets the parent container for the new view. The parent
 * @param container
 * @return
 */
public Builder setContainer(ViewGroup container){
    if (container.getId() == -1){
        throw new RuntimeException("Parent Container must have id set");
    }

    containerId = container.getId();

    return this;
}
 
開發者ID:kevinwang5658,項目名稱:backstack,代碼行數:15,代碼來源:LinearBackStack.java

示例12: startUpdate

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public void startUpdate(ViewGroup container) {
    final int containerId = container.getId();
    if (containerId != View.NO_ID) {
        mContainerId = container.getId();
    } else {
        throw new IllegalStateException("ViewPager with adapter " + this
                + " requires a view id");
    }
}
 
開發者ID:nekocode,項目名稱:Hubs,代碼行數:11,代碼來源:ExFragmentPagerAdapter.java

示例13: onItemClicked

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public void onItemClicked(ViewGroup parent, View view, int position) {
    switch (parent.getId()) {
        case R.id.recycler_view_similar:
            Media media = mSimilarList.get(position);
            if (media != null && getActivity() != null && getActivity().getSupportFragmentManager() != null) {
                getActivity().getSupportFragmentManager()
                        .beginTransaction()
                        .replace(R.id.layout_outlet, MovieDetailsFragment.newInstance(media.getId(), media.getTitle()))
                        .commit();
                mCallbacks.scrollToTop();
            }
            break;
    }
}
 
開發者ID:scaffeinate,項目名稱:Inflix,代碼行數:16,代碼來源:MovieDetailsFragment.java

示例14: onInterceptTouchEvent

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public boolean onInterceptTouchEvent(ViewGroup v, MotionEvent event) {
  int currentJSResponder = mCurrentJSResponder;
  if (currentJSResponder != JS_RESPONDER_UNSET && event.getAction() != MotionEvent.ACTION_UP) {
    // Don't intercept ACTION_UP events. If we return true here than UP event will not be
    // delivered. That is because intercepted touch events are converted into CANCEL events
    // and make all further events to be delivered to the view that intercepted the event.
    // Therefore since "UP" event is the last event in a gesture, we should just let it reach the
    // original target that is a child view of {@param v}.
    // http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent)
    return v.getId() == currentJSResponder;
  }
  return false;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:15,代碼來源:JSResponderHandler.java

示例15: setBarVisible

import android.view.ViewGroup; //導入方法依賴的package包/類
protected void setBarVisible(ViewGroup barLayout, boolean visible) {
    if (barLayout.getId() == R.id.document__fragment__edit__textmodule_actions_bar && barLayout.getParent() instanceof HorizontalScrollView) {
        ((HorizontalScrollView) barLayout.getParent())
                .setVisibility(visible ? View.VISIBLE : View.GONE);
    }
}
 
開發者ID:gsantner,項目名稱:markor,代碼行數:7,代碼來源:TextModuleActions.java


注:本文中的android.view.ViewGroup.getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。