Last active
June 25, 2018 05:51
-
-
Save yaraki/24c94955f82f1d182d0f7fffa120c2fd to your computer and use it in GitHub Desktop.
Place an icon at the end of a "wrap_content" text view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<TextView | |
android:id="@+id/message" | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
android:background="#9f9" | |
android:text="It is fine today." | |
android:textAppearance="@style/TextAppearance.AppCompat.Large" | |
app:layout_constraintEnd_toStartOf="@id/icon" | |
app:layout_constraintHorizontal_bias="0" | |
app:layout_constraintHorizontal_chainStyle="packed" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:layout_constraintWidth_default="wrap"/> | |
<ImageView | |
android:id="@+id/icon" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:src="@drawable/ic_android" | |
android:tint="?attr/colorAccent" | |
app:layout_constraintBottom_toBottomOf="@id/message" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toEndOf="@id/message" | |
app:layout_constraintTop_toTopOf="@id/message"/> | |
</android.support.constraint.ConstraintLayout> |
That's perfect!!! ๐ ๐ ๐
Thank you so much! ๐โโ๏ธ
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Revision 2 has: