• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to locate an image inside ExpandableTextView?

Ayush95

Lurker
Hi, I created expandable text view's in a Fragment. It is working fine as of now. But may i know how can i place an image inside it (as if, that image should not be displayed before expanding the view).

Can anyone help me in this.?

Attached screen shot for reference. I want the image icon, inside the expand contents.

Code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/title"
        android:layout_width="match_parent"
        android:layout_height="36dp"

        android:background="@color/title_bg_color"
        android:gravity="bottom"
        android:padding="5dp"
        android:singleLine="true"
        android:textColor="#333333"
        android:textSize="18sp" />

    <com.ms.square.android.expandabletextview.ExpandableTextView
        android:id="@+id/expand_text_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        expandableTextView:maxCollapsedLines="2">

        <TextView
            android:id="@id/expandable_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/text_bg_color"
            android:fontFamily="sans-serif-light"
            android:padding="5dp"
            android:textColor="#494848"
            android:textSize="16sp" />
     
        <ImageButton
            android:id="@id/expand_collapse"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right|bottom"

            android:background="@color/text_bg_color"
            android:padding="5dp" />
     
    </com.ms.square.android.expandabletextview.ExpandableTextView>

</LinearLayout>
 

Attachments

  • a.jpg
    a.jpg
    31.5 KB · Views: 127
Last edited:
Back
Top Bottom