本文整理汇总了Java中android.widget.RelativeLayout.setOnLongClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java RelativeLayout.setOnLongClickListener方法的具体用法?Java RelativeLayout.setOnLongClickListener怎么用?Java RelativeLayout.setOnLongClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.setOnLongClickListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ComplexButton
import android.widget.RelativeLayout; //导入方法依赖的package包/类
public ComplexButton(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.complex_button, this);
button = (RelativeLayout) findViewById(R.id.complex_button_body);
rightArrow = (ImageView) findViewById(R.id.complex_button_item_right_arrow);
circleImageView = (CircleImageView) findViewById(R.id.complex_button_item_image);
itemName = (TextView) findViewById(R.id.complex_button_item_name);
detail = (TextView) findViewById(R.id.complex_button_item_detail);
redDot = (ImageView) findViewById(R.id.complex_button_red_dot);
redDot.setVisibility(GONE);
setButtonClickable(true);
button.setLongClickable(true);
button.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
return true;
}
});
selectType(TYPE_IMAGE_ROUND);
}
示例2: addColorButton
import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void addColorButton(){
for(int i=0;i<12;i++){
FloatingActionButton floatingActionButton = new FloatingActionButton(CanvasActivity.this);
floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(colorArr[i])));
floatingActionButton.setCompatElevation(0);
floatingActionButton.setTag("button");
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(108,108);
params.setMargins(32,0,32,0);
final RelativeLayout relativeLayout = new RelativeLayout(CanvasActivity.this);
relativeLayout.addView(floatingActionButton, params);
relativeLayout.setOnClickListener(this);
if(i == 11){
relativeLayout.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setDialog((FloatingActionButton) view.findViewWithTag("button"));
relativeLayout.callOnClick();
return true;
}
});
}
if(i > 5){
colorSelectLayout2.addView(relativeLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
}else{
colorSelectLayout1.addView(relativeLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
}
}
}
示例3: getImageWrapper
import android.widget.RelativeLayout; //导入方法依赖的package包/类
public static RelativeLayout getImageWrapper(Context context, MenuObject menuItem, int menuItemSize,
View.OnClickListener onCLick, View.OnLongClickListener onLongClick,
boolean showDivider) {
RelativeLayout imageWrapper = new RelativeLayout(context);
LinearLayout.LayoutParams imageWrapperLayoutParams = new LinearLayout.LayoutParams(menuItemSize, menuItemSize);
imageWrapper.setLayoutParams(imageWrapperLayoutParams);
imageWrapper.setOnClickListener(onCLick);
imageWrapper.setOnLongClickListener(onLongClick);
imageWrapper.addView(Utils.getItemImageButton(context, menuItem));
if (showDivider) {
imageWrapper.addView(getDivider(context, menuItem));
}
if (menuItem.getBgColor() != 0) {
imageWrapper.setBackgroundColor(menuItem.getBgColor());
} else if (menuItem.getBgDrawable() != null) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
imageWrapper.setBackgroundDrawable(menuItem.getBgDrawable());
} else {
imageWrapper.setBackground(menuItem.getBgDrawable());
}
} else if (menuItem.getBgResource() != 0) {
imageWrapper.setBackgroundResource(menuItem.getBgResource());
} else {
imageWrapper.setBackgroundColor(context.getResources().getColor(R.color.menu_item_background));
}
return imageWrapper;
}