android.app.Activity.findViewById()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(295)

本文整理了Java中android.app.Activity.findViewById()方法的一些代码示例,展示了Activity.findViewById()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.findViewById()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:findViewById

Activity.findViewById介绍

暂无

代码示例

代码示例来源:origin: CarGuo/GSYVideoPlayer

public GSYVideoHelper(Context context, StandardGSYVideoPlayer player) {
  mGsyVideoPlayer = player;
  this.mContext = context;
  this.mWindowViewContainer = (ViewGroup) (CommonUtil.scanForActivity(context)).findViewById(Window.ID_ANDROID_CONTENT);
}

代码示例来源:origin: CarGuo/GSYVideoPlayer

public SmallVideoHelper(Context context, StandardGSYVideoPlayer player) {
  gsyVideoPlayer = player;
  this.context = context;
  this.windowViewContainer = (ViewGroup) (CommonUtil.scanForActivity(context)).findViewById(Window.ID_ANDROID_CONTENT);
}

代码示例来源:origin: robolectric/robolectric

@Implementation
protected TabWidget getTabWidget() {
 Context context = realView.getContext();
 if (context instanceof Activity) {
  return (TabWidget) ((Activity)context).findViewById(R.id.tabs);
 } else {
  return null;
 }
}

代码示例来源:origin: mikepenz/MaterialDrawer

/**
 * Construct a Drawer by passing the activity to use for the generation
 *
 * @param activity current activity which will contain the drawer
 */
public DrawerBuilder(@NonNull Activity activity) {
  this.mRootView = (ViewGroup) activity.findViewById(android.R.id.content);
  this.mActivity = activity;
  this.mLayoutManager = new LinearLayoutManager(mActivity);
  getAdapter();
}

代码示例来源:origin: mikepenz/MaterialDrawer

/**
 * Sets the rootView which will host the DrawerLayout
 * The content of this view will be extracted and added as the new content inside the drawerLayout
 *
 * @param rootViewRes the id of a view which will get switched out by the DrawerLayout and added as its child
 */
public DrawerBuilder withRootView(@IdRes int rootViewRes) {
  if (mActivity == null) {
    throw new RuntimeException("please pass an activity first to use this call");
  }
  return withRootView((ViewGroup) mActivity.findViewById(rootViewRes));
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
  public void run() {
    scrollable = (ObservableScrollView) activity.findViewById(R.id.scrollable);
    scrollable.setScrollViewCallbacks(null);
  }
});

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
  public void run() {
    scrollable = (ObservableWebView) activity.findViewById(R.id.scrollable);
    scrollable.setScrollViewCallbacks(null);
  }
});

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
  public void run() {
    scrollable = (ObservableListView) activity.findViewById(R.id.scrollable);
    scrollable.setScrollViewCallbacks(null);
  }
});

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scrollview_noheader, container, false);

    final ObservableScrollView scrollView = (ObservableScrollView) view.findViewById(R.id.scroll);
    Activity parentActivity = getActivity();
    scrollView.setTouchInterceptionViewGroup((ViewGroup) parentActivity.findViewById(R.id.container));
    if (parentActivity instanceof ObservableScrollViewCallbacks) {
      scrollView.setScrollViewCallbacks((ObservableScrollViewCallbacks) parentActivity);
    }
    return view;
  }
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableListView) activity.findViewById(R.id.scrollable);
  callbackCounter = new int[2];
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableRecyclerView) activity.findViewById(R.id.scrollable);
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableWebView) activity.findViewById(R.id.scrollable);
  callbackCounter = new int[2];
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableScrollView) activity.findViewById(R.id.scrollable);
  callbackCounter = new int[2];
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableGridView) activity.findViewById(R.id.scrollable);
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableListView) activity.findViewById(R.id.scrollable);
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableScrollView) activity.findViewById(R.id.scrollable);
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableWebView) activity.findViewById(R.id.scrollable);
}

代码示例来源:origin: robolectric/robolectric

@Test public void setContentView_shouldReplaceOldContentView() throws Exception {
 View view1 = new View(application);
 view1.setId(R.id.burritos);
 View view2 = new View(application);
 view2.setId(R.id.button);
 Activity activity = buildActivity(Activity.class).create().get();
 activity.setContentView(view1);
 assertSame(view1, activity.findViewById(R.id.burritos));
 activity.setContentView(view2);
 assertNull(activity.findViewById(R.id.burritos));
 assertSame(view2, activity.findViewById(R.id.button));
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableGridView) activity.findViewById(R.id.scrollable);
  callbackCounter = new int[2];
}

代码示例来源:origin: ksoichiro/Android-ObservableScrollView

@Override
protected void setUp() throws Exception {
  super.setUp();
  setActivityInitialTouchMode(true);
  activity = getActivity();
  scrollable = (ObservableRecyclerView) activity.findViewById(R.id.scrollable);
  callbackCounter = new int[2];
  getInstrumentation().waitForIdleSync();
}

相关文章

Activity类方法