user1302569
user1302569

Reputation: 7191

TextView and too long text

I have a problem with some functionality. I have in Action Bar TextView with text. When text is to long I use setEllipsize(TruncateAt.End) and everything work ok. But I want add functionality when user click on this TextView in this place show table with all text. How I can do that. Use dialog or there is any other way to show small field with all text. This text never was longer than 30 chars.

Edit:

<?xml version="1.0" encoding="UTF-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:weightSum="100"
        android:orientation="horizontal"
         >

        <ImageView
            android:id="@+id/homeIcon"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_weight="10"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/loginData"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="25"
            android:layout_marginLeft="5dp"
            android:text="TextView" />

        <ImageView
            android:id="@+id/splitLine"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:src="@drawable/descr_box_left" 
            android:layout_weight="1"
            android:layout_marginLeft="2dp"/>

        <TextView
            android:id="@+id/infoText"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_weight="42"
            android:text="TextView" 
            android:singleLine="true"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:scrollHorizontally="true"
            android:focusable="true" 
            android:focusableInTouchMode="true"/>

        <Button
            android:id="@+id/infoButton"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="15"
            android:layout_marginLeft="5dp"
            android:text="Button" />

        <ImageButton
            android:id="@+id/settingsButton"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_weight="5"
            android:src="@drawable/icon_settings_active" />

    </LinearLayout>

Upvotes: 0

Views: 2294

Answers (1)

dilix
dilix

Reputation: 3893

For example

1) you can popup your own custom dialog with whole text,

2) you can create a new activity with transparent BG with containing text,

3) you can expand you bar and show the whole text,

4) you can implement runnable\scrollable string in your header: Scrolling Textview in android

Upvotes: 3

Related Questions