I want to create a layout when I have an image, text aligned to the left of the layout. and a chip aligned to the left.
I have tried this layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/my_padding"
android:paddingBottom="@dimen/my_padding"
android:paddingLeft="@dimen/my_padding2"
android:paddingRight="@dimen/my_padding2"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/Icon"
android:layout_width="@dimen/icon_size"
android:layout_height="@dimen/icon_size"
android:layout_margin="@dimen/icon_margin"
android:layout_gravity="center_horizontal|center_vertical"
android:contentDescription="@null"
android:importantForAccessibility="no"
tools:ignore="UnusedAttribute" />
<TextView
android:id="@+id/Text"
style="@style/ActionItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_between_icon_and_text"
android:layout_marginLeft="@dimen/margin_between_icon_and_text"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:gravity="start|center_vertical"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<com.my.Chip
android:id="@+id/highlight_chip"
style="@style/Widget.Chip.Suggestive"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="@dimen/margin_between_highlight_chip_and_text"
android:layout_marginLeft="@dimen/margin_between_highlight_chip_and_text"
android:layout_gravity="end|center_vertical"
android:visibility="visible" />
</LinearLayout>
meaning I have Chip with weight and layout_gravity, but the chip is not seen.
how can i fix this?
The strange thing is that I have tried
<com.my.Chip
android:id="@+id/highlight_chip"
style="@style/Widget.GoogleMaterial.Chip.Suggestive"
android:layout_width="10dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_between_highlight_chip_and_text"
android:layout_marginLeft="@dimen/margin_between_highlight_chip_and_text"
android:layout_gravity="end|center_vertical"
android:visibility="visible" />
without weight, and the chip still doesn't show