本文整理汇总了Java中android.view.ViewGroup.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.findViewById方法的具体用法?Java ViewGroup.findViewById怎么用?Java ViewGroup.findViewById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.findViewById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupSettingsButton
import android.view.ViewGroup; //导入方法依赖的package包/类
private void setupSettingsButton(int containerId, int labelId, int imageViewId,
final View.OnClickListener onClickListener) {
ViewGroup container = findViewById(containerId);
TextView buttonLabel = container.findViewById(labelId);
String buttonLabelText = buttonLabel.getText().toString();
ImageView imageView = container.findViewById(imageViewId);
imageView.setContentDescription(buttonLabelText);
container.setOnClickListener(onClickListener);
}
示例2: initEventAndData
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void initEventAndData() {
if (getView() == null)
return;
viewMain = (ViewGroup) getView().findViewById(R.id.view_main);
if (viewMain == null) {
throw new IllegalStateException(
"The subclass of RootActivity must contain a View named 'view_main'.");
}
if (!(viewMain.getParent() instanceof ViewGroup)) {
throw new IllegalStateException(
"view_main's ParentView should be a ViewGroup.");
}
mParent = (ViewGroup) viewMain.getParent();
View.inflate(mContext, R.layout.view_progress, mParent);
viewLoading = mParent.findViewById(R.id.view_loading);
ivLoading = (ProgressImageView) viewLoading.findViewById(R.id.iv_progress);
viewLoading.setVisibility(View.GONE);
viewMain.setVisibility(View.VISIBLE);
}
示例3: setColorForDrawerLayoutDiff
import android.view.ViewGroup; //导入方法依赖的package包/类
/**
* 为DrawerLayout 布局设置状态栏变色(5.0以下无半透明效果,不建议使用)
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
* @param color 状态栏颜色值
*/
@Deprecated
public static void setColorForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// 生成一个状态栏大小的矩形
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
View fakeStatusBarView = contentLayout.findViewById(FAKE_STATUS_BAR_VIEW_ID);
if (fakeStatusBarView != null) {
if (fakeStatusBarView.getVisibility() == View.GONE) {
fakeStatusBarView.setVisibility(View.VISIBLE);
}
fakeStatusBarView.setBackgroundColor(calculateStatusColor(color, DEFAULT_STATUS_BAR_ALPHA));
} else {
// 添加 statusBarView 到布局中
contentLayout.addView(createStatusBarView(activity, color), 0);
}
// 内容布局不是 LinearLayout 时,设置padding top
if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
}
// 设置属性
setDrawerLayoutProperty(drawerLayout, contentLayout);
}
}
示例4: addToggleItemView
import android.view.ViewGroup; //导入方法依赖的package包/类
private SwitchButton addToggleItemView(String key, int titleResId, boolean initState) {
ViewGroup vp = (ViewGroup) getLayoutInflater().inflate(R.layout.nim_user_profile_toggle_item, null);
ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, (int) getResources().getDimension(R.dimen.isetting_item_height));
vp.setLayoutParams(vlp);
TextView titleText = ((TextView) vp.findViewById(R.id.user_profile_title));
titleText.setText(titleResId);
SwitchButton switchButton = (SwitchButton) vp.findViewById(R.id.user_profile_toggle);
switchButton.setCheck(initState);
switchButton.setOnChangedListener(onChangedListener);
switchButton.setTag(key);
toggleLayout.addView(vp);
if (toggleStateMap == null) {
toggleStateMap = new HashMap<>();
}
toggleStateMap.put(key, initState);
return switchButton;
}
示例5: handleDeleteLayer
import android.view.ViewGroup; //导入方法依赖的package包/类
private void handleDeleteLayer(@NonNull View view) {
final ViewGroup layout = (ViewGroup) view.getTag();
if (layout == null) {
return;
}
final TextView input = layout.findViewById(R.id.input_hidden);
if (input == null) {
return;
}
prepareAnimation();
mHiddenSizeInputs.remove(input);
mHiddenGroup.removeView(layout);
checkHiddenSize();
Tracker.getInstance()
.logEvent(TrackCons.Model.CLICK_LAYER_DELETE);
}
示例6: createScrollView
import android.view.ViewGroup; //导入方法依赖的package包/类
private void createScrollView() {
root = (FrameLayout) inflater.inflate(
R.layout.qrh__scrollview_container, null);
NotifyingScrollView scrollView = (NotifyingScrollView) root
.findViewById(R.id.rqh__scroll_view);
scrollView.setOnScrollChangedListener(mOnScrollChangedListener);
root.addView(realHeader, realHeaderLayoutParams);
mContentContainer = (ViewGroup) root.findViewById(R.id.rqh__container);
mContentContainer.addView(content);
dummyHeader = mContentContainer
.findViewById(R.id.rqh__content_top_margin);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, headerHeight);
dummyHeader.setLayoutParams(params);
}
示例7: newBannerSection
import android.view.ViewGroup; //导入方法依赖的package包/类
private BannerSection newBannerSection() {
BannerSection section =
new BannerSection(urls, iBannerUpdate) {
@Override
public View onCreateItemView(ViewGroup parent) {
ViewGroup viewGroup = (ViewGroup) LayoutInflater.from(parent.getContext())
.inflate(R.layout.vlext_section_banner, parent, false);
AutoLooperBanner autoLooperBanner =
(AutoLooperBanner) viewGroup.findViewById(R.id.vlext_banner);
viewGroup.removeView(autoLooperBanner);
return autoLooperBanner;
}
@Override
protected AutoLooperBanner.OnBannerItemClickListener getBannerItemClickListener(List<String> datas) {
return new AutoLooperBanner.OnBannerItemClickListener() {
@Override
public void onItemClick(int position) {
final String msg = "click:" + position + "\r\nurl:" +
getItemDataByPosition(position);
Log.d("lmsg", msg);
Toast.makeText(TestVLayoutComplex.this, msg, Toast.LENGTH_SHORT).show();
}
};
}
};
// MAdapter<BannerSection.BannerSectionViewHolder, List<String>, Void> mAdapter
// = new MAdapter<>(section);
// mAdapter.setSwipeMenuAdapterHelper(swipeMenuAdapterHelper);
// section.setAdapter(mAdapter);
return section;
}
示例8: prepare
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void prepare(ViewGroup layout) {
super.prepare(layout);
EditText prompt = (EditText) layout.findViewById(R.id.js_modal_dialog_prompt);
prompt.setVisibility(View.VISIBLE);
if (mDefaultPromptText.length() > 0) {
prompt.setText(mDefaultPromptText);
prompt.selectAll();
}
}
示例9: initView
import android.view.ViewGroup; //导入方法依赖的package包/类
private void initView(Context context) {
mContext = context;
ViewGroup moreView = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.rfv_footer, this);
moreView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
lytFooter = moreView.findViewById(R.id.lytFooter);
mProgressBar = moreView.findViewById(R.id.rfv_footer_progressbar);
tvLoadState = (TextView) moreView.findViewById(R.id.tvLoadState);
tvReleaseToLoadMore = (TextView) moreView.findViewById(R.id.tvReleaseToLoadMore);
}
示例10: getBrightnessSlider
import android.view.ViewGroup; //导入方法依赖的package包/类
private View getBrightnessSlider() {
if (mBrightnessSlider != null) return mBrightnessSlider;
ViewGroup bv = (ViewGroup)XposedHelpers.getObjectField(mQsPanel, "mBrightnessView");
if (Utils.isOxygenOs35Rom()) {
mBrightnessSlider = bv;
} else {
int resId = mQsPanel.getResources().getIdentifier("brightness_slider", "id",
mQsPanel.getContext().getPackageName());
if (resId != 0) {
mBrightnessSlider = bv.findViewById(resId);
}
}
return mBrightnessSlider;
}
示例11: clearFullscreenLayout
import android.view.ViewGroup; //导入方法依赖的package包/类
public void clearFullscreenLayout() {
ViewGroup vp = (ViewGroup) (JCUtils.scanForActivity(getContext()))//.getWindow().getDecorView();
.findViewById(Window.ID_ANDROID_CONTENT);
View oldF = vp.findViewById(FULLSCREEN_ID);
View oldT = vp.findViewById(TINY_ID);
if (oldF != null) {
vp.removeView(oldF);
}
if (oldT != null) {
vp.removeView(oldT);
}
showSupportActionBar(getContext());
}
示例12: setupMessage
import android.view.ViewGroup; //导入方法依赖的package包/类
protected void setupMessage() {
final ViewGroup contentPanel = getWindow().findViewById(R.id.mongol_dialog_content_panel);
mScrollView = contentPanel.findViewById(R.id.mongol_dialog_content_scrollview);
mScrollView.setFocusable(false);
mMessageView = getWindow().findViewById(R.id.mongol_dialog_message);
final boolean hasTextTitle = !TextUtils.isEmpty(mMessage);
if (hasTextTitle) {
mMessageView.setText(mMessage);
} else {
mMessageView.setVisibility(View.GONE);
mScrollView.removeView(mMessageView);
}
}
示例13: OptionViewHolder
import android.view.ViewGroup; //导入方法依赖的package包/类
OptionViewHolder(ViewGroup rootView) {
mTextViewOption = (TextView) rootView.findViewById(R.id.duo_view_option_text);
mImageViewSelector = (ImageView) rootView.findViewById(R.id.duo_view_option_selector);
mImageViewSelectorSide = (ImageView) rootView.findViewById(R.id.duo_view_option_selector_side);
hideSelectorsByDefault();
}
示例14: addShadow
import android.view.ViewGroup; //导入方法依赖的package包/类
public static Object addShadow(ViewGroup shadowContainer) {
shadowContainer.setLayoutMode(ViewGroup.LAYOUT_MODE_OPTICAL_BOUNDS);
LayoutInflater inflater = LayoutInflater.from(shadowContainer.getContext());
inflater.inflate(R.layout.lb_shadow, shadowContainer, true);
ShadowImpl impl = new ShadowImpl();
impl.mNormalShadow = shadowContainer.findViewById(R.id.lb_shadow_normal);
impl.mFocusShadow = shadowContainer.findViewById(R.id.lb_shadow_focused);
return impl;
}
示例15: onCreateView
import android.view.ViewGroup; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup) inflater
.inflate(R.layout.fragment_walkthrough_slide, container, false);
txtTitle = (TextView) rootView.findViewById(R.id.txtTitle);
txtDescription = (TextView) rootView.findViewById(R.id.txtContent);
return rootView;
}