1. Download our Official Android App: Forums for Android!

Apps How to locate an image inside ExpandableTextView?

Discussion in 'Android Development' started by Ayush95, Sep 15, 2017.

  1. Ayush95

    Ayush95 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Sep 15, 2017

    Sep 15, 2017
    1
    0
    5
    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 (Text):
    1.  
    2.  
    3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    4.     xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
    5.     android:layout_width="match_parent"
    6.     android:layout_height="wrap_content"
    7.     android:orientation="vertical">
    8.  
    9.     <TextView
    10.         android:id="@+id/title"
    11.         android:layout_width="match_parent"
    12.         android:layout_height="36dp"
    13.  
    14.         android:background="@color/title_bg_color"
    15.         android:gravity="bottom"
    16.         android:padding="5dp"
    17.         android:singleLine="true"
    18.         android:textColor="#333333"
    19.         android:textSize="18sp" />
    20.  
    21.     <com.ms.square.android.expandabletextview.ExpandableTextView
    22.         android:id="@+id/expand_text_view"
    23.         android:layout_width="match_parent"
    24.         android:layout_height="wrap_content"
    25.         expandableTextView:maxCollapsedLines="2">
    26.  
    27.         <TextView
    28.             android:id="@id/expandable_text"
    29.             android:layout_width="match_parent"
    30.             android:layout_height="wrap_content"
    31.             android:background="@color/text_bg_color"
    32.             android:fontFamily="sans-serif-light"
    33.             android:padding="5dp"
    34.             android:textColor="#494848"
    35.             android:textSize="16sp" />
    36.      
    37.         <ImageButton
    38.             android:id="@id/expand_collapse"
    39.             android:layout_width="match_parent"
    40.             android:layout_height="wrap_content"
    41.             android:layout_gravity="right|bottom"
    42.  
    43.             android:background="@color/text_bg_color"
    44.             android:padding="5dp" />
    45.      
    46.     </com.ms.square.android.expandabletextview.ExpandableTextView>
    47.  
    48. </LinearLayout>
    49.  
     

    Attached Files:

    • a.jpg
      a.jpg
      File size:
      31.5 KB
      Views:
      49

    Advertisement

    #1 Ayush95, Sep 15, 2017
    Last edited: Sep 15, 2017

Share This Page

Loading...