labelview icon indicating copy to clipboard operation
labelview copied to clipboard

How to remove white border around label.

Open brije111 opened this issue 8 years ago • 5 comments

device-2017-07-20-140742 Everything looks very good. I used this lib and I'm good with it. But when my boss said to remove white border around label view. I searched for any method to remove it but could not find. I stuck. Please help

brije111 avatar Jul 20 '17 06:07 brije111

plz show ur code

linger1216 avatar Jul 21 '17 08:07 linger1216

layout looks like this <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_marginRight="4dp"> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <com.lid.lib.LabelImageView android:id="@+id/icon" android:layout_width="80dp" android:layout_height="80dp" android:scaleType="centerCrop" app:label_backgroundColor="?attr/colorAccent" app:label_orientation="LEFT_TOP" app:label_text="CHINA" app:label_textSize="@dimen/text_size_tertiary" /> <!--<ImageView android:layout_width="100dp" android:layout_height="100dp" android:id="@+id/download_icon" app:srcCompat="@drawable/ic_download"/>--> </FrameLayout> <TextView android:id="@+id/text_view" android:layout_width="80dp" android:layout_height="wrap_content" android:text="theme1" android:gravity="center" android:textSize="@dimen/text_size_primary" /> </LinearLayout> and Here is Adapter Code `private class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder>{ private Context context; public MyAdapter(Context context) { this.context=context; }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.theme_recycler_item,parent,false));
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {
        Glide.with(context).load(themes.get(position).getIconURL()).into(holder.icon);
        holder.textView.setText(themes.get(position).getName());
        if (themes.get(position).isDownloaded&&themes.get(position).isValid()) {
            String str=sharedPreferences.getString(Constants.SHAREDPREF.THEME, "no_theme");
            if (str.equals("no_theme")&&position==0){
                holder.icon.setLabelText("Active");
                holder.icon.setLabelTextColor(Color.WHITE);
                holder.icon.setLabelVisual(true);
                holder.icon.setLabelBackgroundColor(ContextCompat.getColor(getActivity(), R.color.green));
                //holder.download_icon.setImageResource(R.drawable.ic_check_green);
            } else if (themes.get(position).getName().equals(str)) {
                holder.icon.setLabelText("Active");
                holder.icon.setLabelTextColor(Color.WHITE);
                holder.icon.setLabelVisual(true);
                holder.icon.setLabelBackgroundColor(ContextCompat.getColor(getActivity(), R.color.green));
                //holder.download_icon.setImageResource(R.drawable.ic_check_green);
            } else {
                //holder.icon.setLabelText("");
                //holder.icon.setLabelTextColor(Color.TRANSPARENT);
                holder.icon.setLabelVisual(false);
                //holder.download_icon.setImageResource(R.drawable.ic_check);
            }
        } else {
            holder.icon.setLabelText("buy now");
            holder.icon.setLabelTextColor(Color.WHITE);
            holder.icon.setLabelVisual(true);
            holder.icon.setLabelBackgroundColor(ContextCompat.getColor(getActivity(), R.color.red));
            //holder.download_icon.setImageResource(R.drawable.ic_download);
        }
    }

    @Override
    public int getItemCount() {
        return themes.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder{
        LabelImageView icon;
        TextView textView;
        public ViewHolder(View itemView) {
            super(itemView);
            icon=(LabelImageView) itemView.findViewById(R.id.icon);
            //download_icon=(ImageView) itemView.findViewById(R.id.download_icon);
            textView=(TextView) itemView.findViewById(R.id.text_view);
        }
    }
}`

brije111 avatar Jul 25 '17 04:07 brije111

use the lib version 1.1.0 or remove the // rectStrokePaint.setColor(strokeColor); // rectStrokePaint.setStrokeWidth(strokeWidth); in LabelViewHelper.

xiaozhao0331 avatar Dec 04 '17 09:12 xiaozhao0331

@brije111 Did you ever find solution for this one?

poojakaluskar avatar Apr 16 '18 17:04 poojakaluskar

I ended up using app:label_strokeColor="@android:color/transparent" to remove border. You can set your desire color.

poojakaluskar avatar Apr 16 '18 20:04 poojakaluskar