Reputation: 1147
so I'm trying to generate a button that looks like this
so far what I've achieved looks like this
This is the code I'm using
chip.setChipStrokeColorResource(R.color.utilitiesColor)
chip.chipStrokeWidth = 2.0f
chip.setChipIconTintResource(R.color.utilitiesColor) //T
chip.setCloseIconTintResource(R.color.utilitiesColor) //T
chip.setTextColor(Color.parseColor("#115fff"))
chip.setTypeface(null, Typeface.BOLD)
chip.chipIcon = ContextCompat.getDrawable(this.context, R.drawable.ic_utilities)
The 2 lines i've commented with T are the ones I tried adding to achieve this icon background color but they don't seem to change anything, you may not see the icon in the picture but it's there its just white on white so you can't see without the stroke.
Any help is appreciated.
Upvotes: 2
Views: 3485
Reputation: 863
Please check this formate
<android.support.constraint.ConstraintLayout
android:layout_width="150dp"
android:layout_height="50dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/text1"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/round_button">
<TextView
android:layout_width="150dp"
android:layout_height="50dp"
android:gravity="center"
android:text="Utilites (200)"
android:layout_marginEnd="10dp"
android:paddingLeft="5dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:textAlignment="viewEnd"
/>
</android.support.constraint.ConstraintLayout>
<ImageView
android:id="@+id/imageView"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="120dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/text1"
app:srcCompat="@drawable/your_image" />
round.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp" />
<solid android:color="@android:color/white" />
<stroke
android:color="@android:color/holo_blue_dark"
android:width="2dp">
</stroke>
Upvotes: 1