0

As the title says, I want to stop the "ellipsis" from occurring and for it to show the whole string associated to that button. I can´t figure out why it is not displaying the string, but instead it is trimming it.

I know that "singleLine" forces a "trimming", but I want it in a single line, and not to wrap. I need the button to show it´s small string in one line, that´s all.

I have also tried using minWidth and maxWidth to no avail.

The problem occurs when viewing the layout in an Android 2.3.6 phone (Samsung Galaxy Mini).

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:context=".MainActivity"
    android:background="@drawable/background2" >

<ImageButton
    android:id="@+id/quote"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="24dp"
    android:contentDescription="@string/quote"
    android:background="#00000000"
    android:padding="30dp" />

  <ScrollView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="90dp" >
      <RelativeLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
           >

             <Button
                android:id="@+id/makeAMemory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="80dp"
                android:layout_marginRight="70dp"
                android:text="@string/button_addMemory"
                android:singleLine="true"
                android:textColor="#E4F5ED"
                android:background="@drawable/button_shape_shadow" 
                android:padding="10dp"/>
             <Button
                android:id="@+id/fixMemory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/makeAMemory"
                android:gravity="left"
                android:layout_marginTop="12dp"
                android:text="@string/button_fixMemory"
                android:textColor="#E4F5ED"
                android:background="@drawable/button_shape_shadow" 
                android:padding="10dp"
                android:onClick="startListViewMemoryActivity"/>
              <Button
                android:id="@+id/getMemory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/fixMemory"
                android:gravity="left"
                android:layout_marginTop="12dp"
                android:text="@string/button_getMemory"
                android:textColor="#E4F5ED"
                android:background="@drawable/button_shape_shadow"  
                android:padding="10dp"/>

      </RelativeLayout>
  </ScrollView>

</RelativeLayout>

The string is "Make memory". It´s not long at all! Any help is much appreciated.

EDITED

Chayemor
  • 3,577
  • 4
  • 31
  • 54

2 Answers2

0

try adding:

android:ellipsize="none"

EDITED

KickAss
  • 4,210
  • 8
  • 33
  • 41
  • Should be android:ellipsize="none", but that only removes the ellipsis, it doesn´t make the button wrap on its content as it should. – Chayemor Dec 31 '13 at 00:03
  • http://stackoverflow.com/questions/4619899/difference-between-a-views-padding-and-margin I use the margin to separate the button from other objects, and the padding within to set a space between the border of the button and its text. – Chayemor Dec 31 '13 at 00:07
  • I need to edit my question. I don´t want the button´s width to be so huge, just to be as wide as its string. – Chayemor Dec 31 '13 at 00:19
  • I've tested the xml, it seems to be fine on my test. The size of the button changes when I change the text for it, it wraps to the content. – KickAss Dec 31 '13 at 00:21
  • Try restarting Eclipse, it has glitches sometimes. – KickAss Dec 31 '13 at 00:21
  • In my emulator it works fine too (my version, your version doesn´t wrap, it makes the button way wider than the text), but when I try it out on a Samsung Galaxy Mini with Andrid 2.3.6 it ellipsifies to no end. – Chayemor Dec 31 '13 at 00:22
  • That seems to indicate its the device's problem. Erm check Android 2.3.6 xml layouts. See how the newer versions differ. – KickAss Dec 31 '13 at 00:24
0

In the end this is what worked:

  1. Took out the ScrollView
  2. Changed RelativeView from "wrap_content" to "match_parent" for the android:layout_width
  3. The rest stays the same

It looks like this:

<RelativeLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_centerHorizontal="true"
       android:layout_marginTop="90dp"
        >
Chayemor
  • 3,577
  • 4
  • 31
  • 54