当前位置: 首页>>代码示例>>Java>>正文


Java RelativeLayout.setOnLongClickListener方法代码示例

本文整理汇总了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);
}
 
开发者ID:838030195,项目名称:DaiGo,代码行数:25,代码来源:ComplexButton.java

示例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));
        }
    }
}
 
开发者ID:DSM-GRAM,项目名称:Artist,代码行数:31,代码来源:CanvasActivity.java

示例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;
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:29,代码来源:Utils.java


注:本文中的android.widget.RelativeLayout.setOnLongClickListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。