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


Java ViewGroup.findViewById方法代码示例

本文整理汇总了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);
}
 
开发者ID:googlesamples,项目名称:android-AutofillFramework,代码行数:10,代码来源:SettingsActivity.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:RootFragment.java

示例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);
    }
}
 
开发者ID:wheat7,项目名称:VRPlayer,代码行数:32,代码来源:StatusBarUtil.java

示例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;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:23,代码来源:UserProfileActivity.java

示例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);
}
 
开发者ID:huazhouwang,项目名称:Synapse,代码行数:23,代码来源:NeuralModelActivity.java

示例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);
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:20,代码来源:QuickReturnHeaderHelper.java

示例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;
    }
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:34,代码来源:TestVLayoutComplex.java

示例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();
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:12,代码来源:JavascriptAppModalDialog.java

示例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);
}
 
开发者ID:Implementist,项目名称:iReading,代码行数:11,代码来源:RefreshViewFooter.java

示例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;
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:16,代码来源:QsPanel.java

示例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());
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:14,代码来源:JCVideoPlayer.java

示例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);
    }
}
 
开发者ID:suragch,项目名称:mongol-library,代码行数:14,代码来源:MongolAlertDialog.java

示例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();
}
 
开发者ID:PSD-Company,项目名称:duo-navigation-drawer,代码行数:8,代码来源:DuoOptionView.java

示例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;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:10,代码来源:ShadowHelperJbmr2.java

示例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;
}
 
开发者ID:guidedways,项目名称:walkthrough_onboarding,代码行数:13,代码来源:WalkthroughContentFragment.java


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