skip to Main Content

enter image description hereenter image description here

Hi,i need little bit help, need to show Shop name and share icon in Centre. I am unable to handle it properly shop. Shop name can be 3 character or max 2 lines. If 2 lines then show share icon top right corner.
also in case 2 lines there is spacing issue icon not adjacent.

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/llShare"
    android:layout_width="@dimen/_88sdp"
    android:orientation="horizontal"
    android:gravity="center_horizontal"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/tvStore"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toStartOf="@id/ivShare"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        style="@style/poppins_semibold"
        android:layout_marginTop="@dimen/_2sdp"
        android:gravity="center_horizontal"
        android:layout_marginStart="@dimen/_5sdp"
        android:layout_marginEnd="@dimen/_5sdp"
        android:minLines="2"
        android:maxLines="2"
        android:ellipsize="end"
        android:textColor="@color/colorGray900"
        android:textSize="@dimen/_9sdp"
        android:textStyle="normal"
        tools:text="Ashkanani" />

    <ImageView
        android:id="@+id/ivShare"
        android:layout_width="@dimen/_12sdp"
        android:background="@drawable/ic_share_arrow_png"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/tvStore"
        android:layout_height="@dimen/_12sdp"/>

</androidx.constraintlayout.widget.ConstraintLayout>

2

Answers


  1. Can you share your XML file here?

    Login or Signup to reply.
  2. Consider textview as your shopname and imageview as share icon
    Textview is limited to 2 lines with end elipse size

    <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toStartOf="@id/iv_closeBottomSheet"
            android:maxLines="2"
            android:ellipsize="end"
            android:text="sakjdak alkdalksldaalkdalkslda alskdlak alsdklask"
            android:id="@+id/tvTitle"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    
        <ImageView
            android:id="@+id/iv_closeBottomSheet"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/tvTitle"
            />
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search