Code Monkey home page Code Monkey logo

Comments (5)

xiaozhao0331 avatar xiaozhao0331 commented on August 18, 2024 1

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

from labelview.

poojakaluskar avatar poojakaluskar commented on August 18, 2024 1

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

from labelview.

linger1216 avatar linger1216 commented on August 18, 2024

plz show ur code

from labelview.

brije111 avatar brije111 commented on August 18, 2024

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);
        }
    }
}`

from labelview.

poojakaluskar avatar poojakaluskar commented on August 18, 2024

@brije111 Did you ever find solution for this one?

from labelview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.