本文整理汇总了Java中android.widget.FrameLayout.setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.setOnClickListener方法的具体用法?Java FrameLayout.setOnClickListener怎么用?Java FrameLayout.setOnClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.FrameLayout
的用法示例。
在下文中一共展示了FrameLayout.setOnClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cart_popupview);
linearLayout = (LinearLayout) findViewById(R.id.linearlayout);
clearLayout = (LinearLayout)findViewById(R.id.clear_layout);
shopingcartLayout = (FrameLayout)findViewById(R.id.shopping_cart_layout);
bottomLayout = (LinearLayout)findViewById(R.id.shopping_cart_bottom);
totalPriceTextView = (TextView)findViewById(R.id.shopping_cart_total_tv);
totalPriceNumTextView = (TextView)findViewById(R.id.shopping_cart_total_num);
recyclerView = (RecyclerView)findViewById(R.id.recycleview);
shopingcartLayout.setOnClickListener(this);
bottomLayout.setOnClickListener(this);
clearLayout.setOnClickListener(this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
dishAdapter = new PopupDishAdapter(getContext(),shopCart);
recyclerView.setAdapter(dishAdapter);
dishAdapter.setShopCartImp(this);
showTotalPrice();
}
示例2: ImageHolder
import android.widget.FrameLayout; //导入方法依赖的package包/类
ImageHolder(View itemView, int itemSize, boolean hasCamera, @Album.ChoiceMode int choiceMode, ColorStateList selector,
OnItemClickListener itemClickListener, OnItemCheckedListener itemCheckedListener) {
super(itemView);
itemView.getLayoutParams().height = itemSize;
this.itemSize = itemSize;
this.hasCamera = hasCamera;
this.mChoiceMode = choiceMode;
this.mItemClickListener = itemClickListener;
this.mItemCheckedListener = itemCheckedListener;
mIvImage = (ImageView) itemView.findViewById(R.id.iv_album_content_image);
mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.cb_album_check);
mLayoutLayer = (FrameLayout) itemView.findViewById(R.id.layout_layer);
itemView.setOnClickListener(this);
mCheckBox.setOnClickListener(this);
mLayoutLayer.setOnClickListener(this);
if (mChoiceMode == Album.MODE_MULTIPLE) {
mCheckBox.setVisibility(View.VISIBLE);
mCheckBox.setSupportButtonTintList(selector);
} else {
mCheckBox.setVisibility(View.GONE);
}
}
示例3: VideoHolder
import android.widget.FrameLayout; //导入方法依赖的package包/类
VideoHolder(View itemView, int itemSize, boolean hasCamera, @Album.ChoiceMode int choiceMode, ColorStateList selector,
OnItemClickListener itemClickListener, OnItemCheckedListener itemCheckedListener) {
super(itemView);
itemView.getLayoutParams().height = itemSize;
this.itemSize = itemSize;
this.hasCamera = hasCamera;
this.mChoiceMode = choiceMode;
this.mItemClickListener = itemClickListener;
this.mItemCheckedListener = itemCheckedListener;
mIvImage = (ImageView) itemView.findViewById(R.id.iv_album_content_image);
mCheckBox = (AppCompatCheckBox) itemView.findViewById(R.id.cb_album_check);
mTvDuration = (TextView) itemView.findViewById(R.id.tv_duration);
mLayoutLayer = (FrameLayout) itemView.findViewById(R.id.layout_layer);
itemView.setOnClickListener(this);
mCheckBox.setOnClickListener(this);
mLayoutLayer.setOnClickListener(this);
if (mChoiceMode == Album.MODE_MULTIPLE) {
mCheckBox.setVisibility(View.VISIBLE);
mCheckBox.setSupportButtonTintList(selector);
} else {
mCheckBox.setVisibility(View.GONE);
}
}
示例4: initView
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initView() {
inflate(getContext(), R.layout.alerter_alert_view, this);
setHapticFeedbackEnabled(true);
ViewCompat.setTranslationZ(this, Integer.MAX_VALUE);
flBackground = (FrameLayout) findViewById(R.id.flAlertBackground);
flClickShield = (FrameLayout) findViewById(R.id.flClickShield);
ivIcon = (ImageView) findViewById(R.id.ivIcon);
tvTitle = (TextView) findViewById(R.id.tvTitle);
tvText = (TextView) findViewById(R.id.tvText);
rlContainer = (ViewGroup) findViewById(R.id.rlContainer);
pbProgress = (ProgressBar) findViewById(R.id.pbProgress);
flBackground.setOnClickListener(this);
//Setup Enter & Exit Animations
slideInAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.alerter_slide_in_from_top);
slideOutAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.alerter_slide_out_to_top);
slideInAnimation.setAnimationListener(this);
//Set Animation to be Run when View is added to Window
setAnimation(slideInAnimation);
}
示例5: setupNavigationButton
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void setupNavigationButton(@NonNull View view, @IdRes int buttonId, @IdRes int imageId) {
FrameLayout frameButton = view.findViewById(buttonId);
frameButton.setOnClickListener(this);
frameButton.setOnLongClickListener(this);
ImageView buttonImage = view.findViewById(imageId);
buttonImage.setColorFilter(mIconColor, PorterDuff.Mode.SRC_IN);
}
示例6: init
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void init() {
// Inflating the background area
inflate(getContext(), R.layout.view_base_swipe, BaseSwipeActionView.this);
swipeContainer = findViewById(R.id.swipeContainer);
AppCompatImageView leftIconView = (AppCompatImageView) findViewById(R.id.leftIcon);
leftIconView.setImageResource(getLeftIconResId());
AppCompatImageView rightIconView = (AppCompatImageView) findViewById(R.id.rightIcon);
rightIconView.setImageResource(getRightIconResId());
// Inflating the foreground area
childContainer = (FrameLayout) findViewById(R.id.childContainer);
childContainer.setBackgroundColor(Color.CYAN);
LayoutInflater.from(getContext()).inflate(getOverlayLayoutResId(), childContainer, true);
childContainer.setOnClickListener(containerClickListenerWrapper);
minimumXtoHandleEvents = getResources().getDimension(R.dimen.dimen_swipe_minumum_x);
if (isSwipeEnabled()) {
initGestureDetector();
}
}
示例7: addStickerTab
import android.widget.FrameLayout; //导入方法依赖的package包/类
public void addStickerTab(TLRPC.Document sticker) {
final int position = tabCount++;
FrameLayout tab = new FrameLayout(getContext());
tab.setFocusable(true);
tab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
delegate.onPageSelected(position);
}
});
tabsContainer.addView(tab);
tab.setSelected(position == currentPosition);
BackupImageView imageView = new BackupImageView(getContext());
if (sticker != null && sticker.thumb != null) {
imageView.setImage(sticker.thumb.location, null, "webp", null);
}
imageView.setAspectFit(true);
tab.addView(imageView, LayoutHelper.createFrame(30, 30, Gravity.CENTER));
}
示例8: createFabMenuItem
import android.widget.FrameLayout; //导入方法依赖的package包/类
private View createFabMenuItem(MenuItem menuItem) {
ViewGroup fabMenuItem = (ViewGroup) LayoutInflater.from(getContext())
.inflate(getMenuItemLayoutId(), this, false);
FloatingActionButton miniFab = (FloatingActionButton) fabMenuItem.findViewById(R.id.mini_fab);
FrameLayout cardView = (FrameLayout) fabMenuItem.findViewById(R.id.card_view);
TextView titleView = (TextView) fabMenuItem.findViewById(R.id.title_view);
fabMenuItemMap.put(miniFab, menuItem);
cardViewMenuItemMap.put(cardView, menuItem);
miniFab.setImageDrawable(menuItem.getIcon());
miniFab.setOnClickListener(this);
cardView.setOnClickListener(this);
ViewCompat.setAlpha(miniFab, 0f);
ViewCompat.setAlpha(cardView, 0f);
final CharSequence title = menuItem.getTitle();
if (!TextUtils.isEmpty(title) && miniFabTitlesEnabled) {
//cardView.setCardBackgroundColor(miniFabTitleBackgroundTint.getDefaultColor());
titleView.setText(title);
titleView.setTypeface(null, Typeface.BOLD);
titleView.setTextColor(miniFabTitleTextColor);
} else {
fabMenuItem.removeView(cardView);
}
miniFab.setBackgroundTintList(miniFabBackgroundTint);
if (Utils.hasLollipop()) {
miniFab.setImageTintList(miniFabDrawableTint);
}
return fabMenuItem;
}
示例9: onCreate
import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = this;
tracker = new LocationTracker(context);
setContentView(R.layout.activity_select_position);
mVisible = true;
mControlsView = findViewById(R.id.fullscreen_content_controls);
mContentView = (FrameLayout) findViewById(R.id.fullscreen_content);
MapFragment frag = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.map_frag);
if (frag != null && mVisible){
frag.getView().setOnTouchListener(mDelayHideTouchListener);
}
// Set up the user interaction to manually show or hide the system UI.
mContentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
toggle();
}
});
// Upon interacting with UI controls, delay any scheduled hide()
// operations to prevent the jarring behavior of controls going away
// while interacting with the UI.
setupViews();
}
示例10: afterPlatformListGot
import android.widget.FrameLayout; //导入方法依赖的package包/类
/** 显示平台列表 */
public void afterPlatformListGot() {
String name = String.valueOf(reqData.get("platform"));
int size = platformList == null ? 0 : platformList.length;
views = new View[size];
final int dp_24 = dipToPx(getContext(), 24);
LinearLayout.LayoutParams lpItem = new LinearLayout.LayoutParams(dp_24, dp_24);
final int dp_9 = dipToPx(getContext(), 9);
lpItem.setMargins(0, 0, dp_9, 0);
FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
lpMask.gravity = Gravity.LEFT | Gravity.TOP;
int selection = 0;
for (int i = 0; i < size; i++) {
FrameLayout fl = new FrameLayout(getContext());
fl.setLayoutParams(lpItem);
if (i >= size - 1) {
fl.setLayoutParams(new LinearLayout.LayoutParams(dp_24, dp_24));
}
llPlat.addView(fl);
fl.setOnClickListener(this);
ImageView iv = new ImageView(getContext());
iv.setScaleType(ScaleType.CENTER_INSIDE);
iv.setImageBitmap(getPlatLogo(platformList[i]));
iv.setLayoutParams(new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
fl.addView(iv);
views[i] = new View(getContext());
views[i].setBackgroundColor(0xcfffffff);
views[i].setOnClickListener(this);
if (name != null && name.equals(platformList[i].getName())) {
views[i].setVisibility(View.INVISIBLE);
selection = i;
// 编辑分享内容的统计
ShareSDK.logDemoEvent(3, platformList[i]);
}
views[i].setLayoutParams(lpMask);
fl.addView(views[i]);
}
final int postSel = selection;
UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
public boolean handleMessage(Message msg) {
HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
return false;
}
});
}
示例11: initRes
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initRes(View curView) {
try {
view = (GestureImageView) curView.findViewById(R.id.image);
newView = (GestureImageView) curView.findViewById(R.id.new_image);
parentLayout = (FrameLayout) curView.findViewById(R.id.layout);
mProgressbar = (ProgressBar) curView.findViewById(R.id.progress_bar);
mProgressbar.setVisibility(View.VISIBLE);
view.setVisibility(View.VISIBLE);
newView.setVisibility(View.GONE);
view.setClickable(true);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
parentLayout.performClick();
}
});
parentLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (isAdded()) {
getActivity().finish();
getActivity().overridePendingTransition(
R.anim.tt_stay, R.anim.tt_image_exit);
}
}
});
} catch (Exception e) {
}
}
示例12: addIconTabWithCounter
import android.widget.FrameLayout; //导入方法依赖的package包/类
public TextView addIconTabWithCounter(int resId) {
final int position = tabCount++;
FrameLayout tab = new FrameLayout(getContext());
tab.setFocusable(true);
tabsContainer.addView(tab);
ImageView imageView = new ImageView(getContext());
imageView.setImageResource(resId);
imageView.setScaleType(ImageView.ScaleType.CENTER);
tab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
delegate.onPageSelected(position);
}
});
tab.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
tab.setSelected(position == currentPosition);
TextView textView = new TextView(getContext());
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
textView.setTextColor(0xffffffff);
textView.setGravity(Gravity.CENTER);
textView.setBackgroundResource(R.drawable.sticker_badge);
textView.setMinWidth(AndroidUtilities.dp(18));
textView.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), AndroidUtilities.dp(1));
tab.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 18, Gravity.TOP | Gravity.LEFT, 26, 6, 0, 0));
return textView;
}
示例13: afterPlatformListGot
import android.widget.FrameLayout; //导入方法依赖的package包/类
/** display platform list */
public void afterPlatformListGot() {
int size = platformList == null ? 0 : platformList.length;
views = new View[size];
final int dp_24 = dipToPx(getContext(), 24);
LayoutParams lpItem = new LayoutParams(dp_24, dp_24);
final int dp_9 = dipToPx(getContext(), 9);
lpItem.setMargins(0, 0, dp_9, 0);
FrameLayout.LayoutParams lpMask = new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
lpMask.gravity = Gravity.LEFT | Gravity.TOP;
int selection = 0;
for (int i = 0; i < size; i++) {
FrameLayout fl = new FrameLayout(getContext());
fl.setLayoutParams(lpItem);
if (i >= size - 1) {
fl.setLayoutParams(new LayoutParams(dp_24, dp_24));
}
llPlat.addView(fl);
fl.setOnClickListener(this);
ImageView iv = new ImageView(getContext());
iv.setScaleType(ScaleType.CENTER_INSIDE);
iv.setImageBitmap(getPlatLogo(platformList[i]));
iv.setLayoutParams(new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
fl.addView(iv);
views[i] = new View(getContext());
views[i].setBackgroundColor(0xcfffffff);
views[i].setOnClickListener(this);
String platformName = platformList[i].getName();
for(Platform plat : platforms) {
if(platformName.equals(plat.getName())) {
views[i].setVisibility(View.INVISIBLE);
selection = i;
}
}
views[i].setLayoutParams(lpMask);
fl.addView(views[i]);
}
final int postSel = selection;
UIHandler.sendEmptyMessageDelayed(0, 333, new Callback() {
public boolean handleMessage(Message msg) {
HorizontalScrollView hsv = (HorizontalScrollView)llPlat.getParent();
hsv.scrollTo(postSel * (dp_24 + dp_9), 0);
return false;
}
});
}
示例14: initPageView
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initPageView() {
flPage = new FrameLayout(getContext());
flPage.setOnClickListener(this);
flPage.setBackgroundDrawable(new ColorDrawable(0x55000000));
// container of the platform gridview
llPage = new LinearLayout(getContext()) {
public boolean onTouchEvent(MotionEvent event) {
return true;
}
};
llPage.setOrientation(LinearLayout.VERTICAL);
llPage.setBackgroundDrawable(new ColorDrawable(0xffffffff));
FrameLayout.LayoutParams lpLl = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
lpLl.gravity = Gravity.BOTTOM;
llPage.setLayoutParams(lpLl);
flPage.addView(llPage);
// gridview
grid = new PlatformGridView(getContext());
grid.setEditPageBackground(getBackgroundView());
LinearLayout.LayoutParams lpWg = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
grid.setLayoutParams(lpWg);
llPage.addView(grid);
// cancel button
btnCancel = new Button(getContext());
btnCancel.setTextColor(0xff3a65ff);
btnCancel.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
int resId = getStringRes(getContext(), "cancel");
if (resId > 0) {
btnCancel.setText(resId);
}
btnCancel.setPadding(0, 0, 0, com.mob.tools.utils.R.dipToPx(getContext(), 5));
resId = getBitmapRes(getContext(), "classic_platform_corners_bg");
if(resId > 0){
btnCancel.setBackgroundResource(resId);
}else {
btnCancel.setBackgroundDrawable(new ColorDrawable(0xffffffff));
}
LinearLayout.LayoutParams lpBtn = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, com.mob.tools.utils.R.dipToPx(getContext(), 45));
int dp_10 = com.mob.tools.utils.R.dipToPx(getContext(), 10);
lpBtn.setMargins(dp_10, dp_10, dp_10, dp_10);
btnCancel.setLayoutParams(lpBtn);
llPage.addView(btnCancel);
}
示例15: ActivityChooserView
import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
* Create a new instance.
*
* @param context The application environment.
* @param attrs A collection of attributes.
* @param defStyle The default style to apply to this view.
*/
public ActivityChooserView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mContext = context;
TypedArray attributesArray = context.obtainStyledAttributes(attrs,
R.styleable.SherlockActivityChooserView, defStyle, 0);
mInitialActivityCount = attributesArray.getInt(
R.styleable.SherlockActivityChooserView_initialActivityCount,
ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT);
Drawable expandActivityOverflowButtonDrawable = attributesArray.getDrawable(
R.styleable.SherlockActivityChooserView_expandActivityOverflowButtonDrawable);
attributesArray.recycle();
LayoutInflater inflater = LayoutInflater.from(mContext);
inflater.inflate(R.layout.abs__activity_chooser_view, this, true);
mCallbacks = new Callbacks();
mActivityChooserContent = (IcsLinearLayout) findViewById(R.id.abs__activity_chooser_view_content);
mActivityChooserContentBackground = mActivityChooserContent.getBackground();
mDefaultActivityButton = (FrameLayout) findViewById(R.id.abs__default_activity_button);
mDefaultActivityButton.setOnClickListener(mCallbacks);
mDefaultActivityButton.setOnLongClickListener(mCallbacks);
mDefaultActivityButtonImage = (ImageView) mDefaultActivityButton.findViewById(R.id.abs__image);
mExpandActivityOverflowButton = (FrameLayout) findViewById(R.id.abs__expand_activities_button);
mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
mExpandActivityOverflowButtonImage =
(ImageView) mExpandActivityOverflowButton.findViewById(R.id.abs__image);
mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable);
mAdapter = new ActivityChooserViewAdapter();
mAdapter.registerDataSetObserver(new DataSetObserver() {
@Override
public void onChanged() {
super.onChanged();
updateAppearance();
}
});
Resources resources = context.getResources();
mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2,
resources.getDimensionPixelSize(R.dimen.abs__config_prefDialogWidth));
}