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


Java ViewGroup.setId方法代码示例

本文整理汇总了Java中android.view.ViewGroup.setId方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.setId方法的具体用法?Java ViewGroup.setId怎么用?Java ViewGroup.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: testFindSceneById

import android.view.ViewGroup; //导入方法依赖的package包/类
@Test
public void testFindSceneById() {
  ViewGroup container1 = new TestContainer(RuntimeEnvironment.application);
  ViewGroup container2 = new TestContainer(RuntimeEnvironment.application);
  @IdRes int containerId1 = 1;
  @IdRes int containerId2 = 2;
  container1.setId(containerId1);
  container2.setId(containerId2);

  Stage stage1 = director.direct(container1);
  Stage stage2 = director.direct(container2);

  Scene scene1 = new TestScene();
  Scene scene2 = new TestScene();
  stage1.pushScene(scene1);
  stage1.pushScene(scene2);

  Scene scene3 = new TestScene();
  Scene scene4 = new TestScene();
  stage2.pushScene(scene3);
  stage2.pushScene(scene4);

  Director director2 = scene2.hireChildDirector();
  Stage stage3 = director2.direct(new TestContainer(RuntimeEnvironment.application));
  Scene scene5 = new TestScene();
  stage3.pushScene(scene5);

  Director director3 = scene3.hireChildDirector();
  Stage stage4 = director3.direct(new TestContainer(RuntimeEnvironment.application));
  Scene scene6 = new TestScene();
  stage4.pushScene(scene6);

  assertEquals(scene1, director.findSceneById(1));
  assertEquals(scene2, director.findSceneById(2));
  assertEquals(scene3, director.findSceneById(3));
  assertEquals(scene4, director.findSceneById(4));
  assertEquals(scene5, director.findSceneById(5));
  assertEquals(scene6, director.findSceneById(6));
  assertEquals(null, director.findSceneById(7));
}
 
开发者ID:seven332,项目名称:Stage,代码行数:41,代码来源:DirectorTest.java

示例3: testTarget

import android.view.ViewGroup; //导入方法依赖的package包/类
@Test
public void testTarget() {
  ViewGroup container1 = new TestContainer(RuntimeEnvironment.application);
  ViewGroup container2 = new TestContainer(RuntimeEnvironment.application);
  @IdRes int containerId1 = 1;
  @IdRes int containerId2 = 2;
  container1.setId(containerId1);
  container2.setId(containerId2);

  Stage stage1 = director.direct(container1);
  Stage stage2 = director.direct(container2);

  Scene scene1 = new TestScene();
  Scene scene2 = new TestScene();
  stage1.pushScene(scene1);
  stage1.pushScene(scene2);

  Scene scene3 = new TestScene();
  Scene scene4 = new TestScene();
  stage2.pushScene(scene3);
  stage2.pushScene(scene4);

  Director director2 = scene2.hireChildDirector();
  Stage stage3 = director2.direct(new TestContainer(RuntimeEnvironment.application));
  Scene scene5 = new TestScene();
  stage3.pushScene(scene5);

  Director director3 = scene3.hireChildDirector();
  Stage stage4 = director3.direct(new TestContainer(RuntimeEnvironment.application));
  Scene scene6 = new TestScene();
  stage4.pushScene(scene6);

  scene5.setTarget(scene6);
  assertEquals(scene6, scene5.getTarget());
}
 
开发者ID:seven332,项目名称:Stage,代码行数:36,代码来源:DirectorTest.java

示例4: generateLayout

import android.view.ViewGroup; //导入方法依赖的package包/类
private ViewGroup generateLayout() {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout]");

    // Apply data from current theme.

    TypedArray a = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);

    if (!a.hasValue(R.styleable.SherlockTheme_windowActionBar)) {
        throw new IllegalStateException("You must use Theme.Sherlock, Theme.Sherlock.Light, Theme.Sherlock.Light.DarkActionBar, or a derivative.");
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowNoTitle, false)) {
        requestFeature(Window.FEATURE_NO_TITLE);
    } else if (a.getBoolean(R.styleable.SherlockTheme_windowActionBar, false)) {
        // Don't allow an action bar if there is no title.
        requestFeature(Window.FEATURE_ACTION_BAR);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionBarOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    }

    if (a.getBoolean(R.styleable.SherlockTheme_windowActionModeOverlay, false)) {
        requestFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
    }

    a.recycle();

    int layoutResource;
    if (!hasFeature(Window.FEATURE_NO_TITLE)) {
        if (hasFeature(Window.FEATURE_ACTION_BAR_OVERLAY)) {
            layoutResource = R.layout.abs__screen_action_bar_overlay;
        } else {
            layoutResource = R.layout.abs__screen_action_bar;
        }
    } else if (hasFeature(Window.FEATURE_ACTION_MODE_OVERLAY) && !hasFeature(Window.FEATURE_NO_TITLE)) {
        layoutResource = R.layout.abs__screen_simple_overlay_action_mode;
    } else {
        layoutResource = R.layout.abs__screen_simple;
    }

    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[generateLayout] using screen XML " + mActivity.getResources().getString(layoutResource));
    View in = mActivity.getLayoutInflater().inflate(layoutResource, null);
    mDecor.addView(in, new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));

    ViewGroup contentParent = (ViewGroup)mDecor.findViewById(R.id.abs__content);
    if (contentParent == null) {
        throw new RuntimeException("Couldn't find content container view");
    }

    //Make our new child the true content view (for fragments). VERY VOLATILE!
    mDecor.setId(View.NO_ID);
    contentParent.setId(android.R.id.content);

    if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) {
        IcsProgressBar progress = getCircularProgressBar(false);
        if (progress != null) {
            progress.setIndeterminate(true);
        }
    }

    return contentParent;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:64,代码来源:ActionBarSherlockCompat.java


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