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