android.widget.FrameLayout#setClickable ( )源码实例Demo

下面列出了android.widget.FrameLayout#setClickable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: JianshuApp   文件: Plugin.java
protected void init(ViewGroup parent, int width, int height) {
    if (!isDebug && (width <= 0 || height <= 0)) {
        width = height = 1;
    }
    visible = (width != 1 && height != 1);

    // 用于显示遮罩
    mRootLayout = new FrameLayout(parent.getContext());
    mRootLayout.setClickable(true);
    parent.addView(mRootLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    // 用于加载网页
    mWebView = new SafeWebView(parent.getContext());
    mRootLayout.addView(mWebView, new FrameLayout.LayoutParams(width, height, Gravity.CENTER));

    // 初始化
    onInit();
}
 
源代码2 项目: appcan-android   文件: CBrowserMainFrame7.java
@Override
public void onShowCustomView(View view, int requestedOrientation, final CustomViewCallback callback) {
    FrameLayout container = new FrameLayout(mContext);
    container.setBackgroundColor(0xff000000);
    FrameLayout.LayoutParams parm = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    container.setLayoutParams(parm);
    container.setClickable(true);
    container.addView(view);
    //	((EBrowserActivity)mContext).requestWindowFeature()
    WebViewSdkCompat.CustomViewCallback compatCallback=new WebViewSdkCompat.CustomViewCallback() {
        @Override
        public void onCustomViewHidden() {
            callback.onCustomViewHidden();
        }
    };
    ((EBrowserActivity) mContext).showCustomView(container, compatCallback);

}
 
源代码3 项目: appcan-android   文件: CBrowserMainFrame7.java
public void onShowCustomView(View view, int requestedOrientation, final CustomViewCallback callback) {
    FrameLayout container = new FrameLayout(mContext);
    container.setBackgroundColor(0xff000000);
    FrameLayout.LayoutParams parm = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    container.setLayoutParams(parm);
    container.setClickable(true);
    container.addView(view);
    //	((EBrowserActivity)mContext).requestWindowFeature()
    WebViewSdkCompat.CustomViewCallback compatCallback=new WebViewSdkCompat.CustomViewCallback() {
        @Override
        public void onCustomViewHidden() {
            callback.onCustomViewHidden();
        }
    };
    ((EBrowserActivity) mContext).showCustomView(container, compatCallback);

}
 
源代码4 项目: a   文件: MoDialogHUD.java
private void initViews() {
    decorView = ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = new FrameLayout(context);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    );
    rootView.setLayoutParams(layoutParams);
    rootView.setClickable(true);
    rootView.setBackgroundColor(context.getResources().getColor(R.color.btn_bg_press_tp));

    mSharedView = new MoDialogView(context);

}
 
源代码5 项目: MyBookshelf   文件: MoDialogHUD.java
private void initViews() {
    decorView = ((Activity) context).getWindow().getDecorView().findViewById(android.R.id.content);
    rootView = new FrameLayout(context);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
    );
    rootView.setLayoutParams(layoutParams);
    rootView.setClickable(true);
    rootView.setBackgroundColor(context.getResources().getColor(R.color.btn_bg_press_tp));

    mSharedView = new MoDialogView(context);

}
 
源代码6 项目: FABRevealMenu-master   文件: ViewHelper.java
public FrameLayout generateOverlayView() {
    //Overlay view
    FrameLayout mOverlayLayout = new FrameLayout(mContext);
    mOverlayLayout.setLayoutParams(matchParams);
    mOverlayLayout.animate().alpha(0);
    mOverlayLayout.setVisibility(View.GONE);
    mOverlayLayout.setClickable(true);
    return mOverlayLayout;
}
 
源代码7 项目: android_maplibui   文件: SplitCombobox.java
@Override
public void addToLayout(ViewGroup layout)
{
    LinearLayout container = new LinearLayout(getContext());
    container.setOrientation(VERTICAL);
    container.addView(mTitles);
    container.addView(mSpinners);
    addView(container);

    if (!AccountUtil.isProUser(getContext())) {
        FrameLayout splash = new FrameLayout(getContext());
        splash.setClickable(true);
        splash.setBackgroundColor(Color.argb(128, 128, 128, 128));
        ImageView sign = new ImageView(getContext());
        sign.setImageResource(R.drawable.ic_lock_black_24dp);
        sign.setScaleType(ImageView.ScaleType.FIT_CENTER);
        sign.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                ControlHelper.showProDialog(getContext());
            }
        });

        splash.addView(sign);
        addView(splash);
    }

    layout.addView(this);
}
 
源代码8 项目: mobile-sdk-android   文件: VideoChromeClient.java
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
    super.onShowCustomView(view, callback);
    if (owner == null) {
        Clog.w(Clog.baseLogTag, Clog.getString(R.string.fullscreen_video_show_error));
        return;
    }
    ViewGroup root = null;
    if (owner != null) {
        root = owner.getVideoAdView();
    }

    if (root == null) {
        Clog.w(Clog.baseLogTag, Clog.getString(R.string.fullscreen_video_show_error));
        return;
    }

    customViewCallback = callback;
    if (view instanceof FrameLayout) {
        frame = (FrameLayout) view;
        frame.setClickable(true);
        frame.setBackgroundColor(Color.BLACK);
        try {
            root.addView(frame);
        } catch (Exception e) {
            Clog.d(Clog.baseLogTag, e.toString());
        }
    } else {
        frame = null;
    }
}
 
public void disableBar(int index) {

		final int barsCount = ((LinearLayout) this.getChildAt(0)).getChildCount();

		for (int i = 0; i < barsCount; i++) {

			FrameLayout rootFrame = (FrameLayout) ((LinearLayout) this.getChildAt(0)).getChildAt(i);

			int rootChildCount = rootFrame.getChildCount();

			for (int j = 0; j < rootChildCount; j++) {

				if ((int) rootFrame.getTag() != index)
					continue;

				rootFrame.setEnabled(false);
				rootFrame.setClickable(false);

				View childView = rootFrame.getChildAt(j);
				if (childView instanceof LinearLayout) {
					//bar
					LinearLayout barContainerLinear = ((LinearLayout) childView);
					int barContainerCount = barContainerLinear.getChildCount();

					for (int k = 0; k < barContainerCount; k++) {

						View view = barContainerLinear.getChildAt(k);

						if (view instanceof Bar) {

							Bar bar = (Bar) view;

							LayerDrawable layerDrawable = (LayerDrawable) bar.getProgressDrawable();
							layerDrawable.mutate();

							ScaleDrawable scaleDrawable = (ScaleDrawable) layerDrawable.getDrawable(1);

							GradientDrawable progressLayer = (GradientDrawable) scaleDrawable.getDrawable();

							if (progressLayer != null) {

								if (mProgressDisableColor > 0)
									progressLayer.setColor(ContextCompat.getColor(mContext, mProgressDisableColor));
								else
									progressLayer.setColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
							}
						} else {
							TextView titleTxtView = (TextView) view;
							if (mProgressDisableColor > 0)
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, mProgressDisableColor));
							else
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
						}
					}
				}
			}
		}
	}
 
public void enableBar(int index) {

		final int barsCount = ((LinearLayout) this.getChildAt(0)).getChildCount();

		for (int i = 0; i < barsCount; i++) {

			FrameLayout rootFrame = (FrameLayout) ((LinearLayout) this.getChildAt(0)).getChildAt(i);

			int rootChildCount = rootFrame.getChildCount();

			for (int j = 0; j < rootChildCount; j++) {

				if ((int) rootFrame.getTag() != index)
					continue;

				rootFrame.setEnabled(true);
				rootFrame.setClickable(true);

				View childView = rootFrame.getChildAt(j);
				if (childView instanceof LinearLayout) {
					//bar
					LinearLayout barContainerLinear = ((LinearLayout) childView);
					int barContainerCount = barContainerLinear.getChildCount();

					for (int k = 0; k < barContainerCount; k++) {

						View view = barContainerLinear.getChildAt(k);

						if (view instanceof Bar) {

							Bar bar = (Bar) view;

							LayerDrawable layerDrawable = (LayerDrawable) bar.getProgressDrawable();
							layerDrawable.mutate();

							ScaleDrawable scaleDrawable = (ScaleDrawable) layerDrawable.getDrawable(1);

							GradientDrawable progressLayer = (GradientDrawable) scaleDrawable.getDrawable();

							if (progressLayer != null) {

								if (mProgressColor > 0)
									progressLayer.setColor(ContextCompat.getColor(mContext, mProgressColor));
								else
									progressLayer.setColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
							}
						} else {
							TextView titleTxtView = (TextView) view;
							if (mProgressDisableColor > 0)
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, mBarTitleColor));
							else
								titleTxtView.setTextColor(ContextCompat.getColor(mContext, android.R.color.darker_gray));
						}
					}
				}
			}
		}
	}
 
源代码11 项目: SettingView   文件: SettingButton.java
private void initItemView(SettingViewItemData data) {
	FrameLayout itemView = data.getItemView();

	if (itemView instanceof SwitchItemView) {
		((SwitchItemView) itemView).fillData(data.getData());
		itemView.setClickable(false);
		((SwitchItemView) itemView).setOnSwitchItemChangedListener(new onSwitchItemChangedListener() {

			@Override
			public void onSwitchItemChanged(boolean isChecked) {
				// TODO Auto-generated method stub
				if (null != mSettingButtonSwitchListener) {
					mSettingButtonSwitchListener.onSwitchChanged(isChecked);
				}
			}
		});

	} else {
		itemView.setClickable(data.isClickable());
		itemView.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (null != mSettingButtonClickListener) {
					mSettingButtonClickListener.onSettingButtonClick();
				}
			}
		});

		if (itemView instanceof BasicItemViewH) {
			((BasicItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof BasicItemViewV) {
			((BasicItemViewV) itemView).fillData(data.getData());
		} else if (itemView instanceof ImageItemView) {
			((ImageItemView) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewH) {
			((CheckItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewV) {
			((CheckItemViewV) itemView).fillData(data.getData());
		}
	}

	int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.setting_view_min_height), getResources().getDisplayMetrics());
	LinearLayout.LayoutParams lps = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);

	addView(itemView, lps);
}
 
源代码12 项目: SettingView   文件: SettingView.java
private void initItemView(SettingViewItemData data, final int index) {
	FrameLayout itemView = data.getItemView();

	if (itemView instanceof SwitchItemView) {
		((SwitchItemView) itemView).fillData(data.getData());
		((SwitchItemView) itemView).setOnSwitchItemChangedListener(new onSwitchItemChangedListener() {

			@Override
			public void onSwitchItemChanged(boolean isChecked) {
				// TODO Auto-generated method stub
				if (null != mItemSwitchListener) {
					mItemSwitchListener.onSwitchChanged(index, isChecked);
				}
			}
		});
		itemView.setClickable(false);
	} else {
		itemView.setClickable(data.isClickable());
		itemView.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (null != mItemClickListener) {
					mItemClickListener.onItemClick(index);
				}
			}
		});

		if (itemView instanceof BasicItemViewH) {
			((BasicItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof BasicItemViewV) {
			((BasicItemViewV) itemView).fillData(data.getData());
		} else if (itemView instanceof ImageItemView) {
			((ImageItemView) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewH) {
			((CheckItemViewH) itemView).fillData(data.getData());
		} else if (itemView instanceof CheckItemViewV) {
			((CheckItemViewV) itemView).fillData(data.getData());
		}
	}

	int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.setting_view_min_height), getResources().getDisplayMetrics());
	LinearLayout.LayoutParams lps = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);

	addView(itemView, lps);
}