本文整理汇总了Java中android.widget.FrameLayout.setOnLongClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.setOnLongClickListener方法的具体用法?Java FrameLayout.setOnLongClickListener怎么用?Java FrameLayout.setOnLongClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.FrameLayout
的用法示例。
在下文中一共展示了FrameLayout.setOnLongClickListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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));
}