当前位置: 首页>>代码示例>>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;未经允许,请勿转载。