how to align android chips to the end in chipgroup?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 08:31:32

You need to change your ChipGroup group property. here is changed code.

<RelativeLayout
 ....
     >

<TextView

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextTitle"
    android:layout_alignBaseline="@id/chipGroup"
    android:gravity="end|bottom"
    android:layout_marginTop="16dp"
    android:layout_below="@id/toptv"
    android:textColor="@android:color/white"
    android:textStyle="bold"
    android:textSize="14sp"
    android:id="@+id/tt1"
    />

<com.google.android.material.chip.ChipGroup
    android:id="@+id/chipGroup"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_toRightOf="@id/tt1"
    android:layout_below="@id/toptv"
    android:textColor="@android:color/black"
    android:textStyle="bold"
    android:gravity="end"
    android:textSize="12sp"
    />
 </RelativeLayout>

I hope this will work. if not then post your RelativeLayout on your question.

Just Replace it

 <RelativeLayout
 ....
     >

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="TextTitle"
    android:layout_alignBaseline="@+id/chipGroup"
    android:layout_toLeftOf="@+id/chipGroup"
    android:gravity="end|bottom"
    android:layout_marginTop="16dp"
    android:layout_below="@+id/toptv"
    android:textColor="@android:color/white"
    android:textStyle="bold"
    android:textSize="14sp"
    android:id="@+id/tt1"
    />

<com.google.android.material.chip.ChipGroup
    android:id="@+id/chipGroup"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_below="@+id/toptv"
    android:textColor="@android:color/black"
    android:textStyle="bold"
    android:textSize="12sp"
    />
 </RelativeLayout>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!