Googleでは、このタイプのUIアフォーダンスをチップと言います。あなたが最も可能性の高いあなたのチップのためになるでしょう
https://material.google.com/components/chips.html
コンテナがFlowLayout
です。
問題は、Googleにこれらを実装するための既成のコンポーネントがないことです。
は、ここで私は私のチップを作った方法は次のとおりです。
/res/drawable/chip_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/translucent_gray"/>
<corners android:radius="16dp"/>
</shape>
/res/layout/chip.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="32dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:background="@drawable/chip_background">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:maxLines="1"
android:ellipsize="end"
android:textSize="13sp"
android:textColor="@android:color/white"
tools:text="Sample Text"/>
<ImageButton
android:id="@+id/removeButton"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@null"
android:alpha=".8"
android:scaleType="fitCenter"
android:padding="7dp"
android:src="@drawable/ic_cancel_white_24dp"/>
</LinearLayout>
パディングとスケール削除ボタンをタイプすると、チップの楕円にうまく収まるように24dpのアイコンが少し縮小されます。
FlowLayout
の場合は、GitHubで「Android FlowLayout」を検索し、使用するライブラリを見つけることができます。
ありがとう、それは私が必要としたものであり、チップを探すことを知らずに見つけたのだろうかと疑っています。 –