Hayk Mkrtchyan
Hayk Mkrtchyan

Reputation: 3255

How can I make a chipView ractangle

I am using a simple chipView. There is a little problem, the default shape for chip is oval. I want to make it rectangle and add a little radius to corners? How can I achieve this?

Upvotes: 3

Views: 1253

Answers (2)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363865

You can do it in 2 ways.

The fastest way is the use of app:chipCornerRadius attribute in the layout.

The 2nd way allows you to draw different kind of shapes using the app:shapeAppearanceOverlay attribute:

    <com.google.android.material.chip.Chip
        app:shapeAppearanceOverlay="@style/buttomShape0"
        ../>

with:

  <style name="buttomShape0">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSize">0dp</item>
  </style>

enter image description here

Upvotes: 3

Hayk Mkrtchyan
Hayk Mkrtchyan

Reputation: 3255

I found the solution

    app:chipCornerRadius=""

Upvotes: 3

Related Questions