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