0

This is my list_row_details xml file for each children view:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
    android:layout_height="60dp"
    android:clickable="true"
    android:orientation="horizontal"
     android:background="#083961"
    android:paddingLeft="40dp" >

     <TextView
         android:id="@+id/textView1"
         android:layout_width="66dp"
         android:layout_height="wrap_content"
         android:drawableLeft="@drawable/ic_launcher"
         android:drawablePadding="5dp"
         android:gravity="center"
         android:text="@string/hello_world"
         android:textSize="14sp"

         android:textStyle="bold" >

    </TextView>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@android:color/black" />

This is the code where I am adding items to expandable list:

public class ImagePage extends Activity {
    SparseArray<Group> groups = new SparseArray<Group>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image_page);

        createData();
        ExpandableListView listView = (ExpandableListView) findViewById(R.id.expandableListView1);
        MyExpandableListAdapter adapter = new MyExpandableListAdapter(this,
                groups);
        listView.setAdapter(adapter);
   }

   public void createData() {
        Bundle b=getIntent().getExtras();
        String s[]=b.getStringArray("label");

        for (int j = 0; j <s.length; j++) {
           Group group = new Group(s[j]);
           for (int i = 0; i <4; i++) {
              group.children.add("Test"+i);
           }
           groups.append(j, group);
        }
   }    
} 

Here DoubleChild.a is a two dimensional array which is declared in another class.

Here is my Group class:

public class Group {
     public String string;
      public final List<String> children = new ArrayList<String>();

      public Group(String string) {
        this.string = string;
      }
}

Desired result:

enter image description here

Current result:

enter image description here

So Test is shows like (Expandable list Children view )

T
e
st
0

But I want it to in one line:

Test 0

I am not getting what I'm doing wrong.

Pang
  • 9,564
  • 146
  • 81
  • 122
Ajay Sharma
  • 166
  • 1
  • 6
  • Problem with your layout. It seems wrong. LinearLayout is having horizontal orientation and You have one child TextView with some static width but View is having match_parent for width. Please provide your full layout xml file. – Hardik Trivedi Feb 12 '15 at 09:08
  • Try setting `android:singleLine="true"` on your TextView. For your reference: http://developer.android.com/reference/android/widget/TextView.html#attr_android:singleLine – Phantômaxx Feb 12 '15 at 09:21
  • @HardikTrivedi it was first vertical then i changed it but still no effects. – Ajay Sharma Feb 12 '15 at 10:30
  • @DerGolem Now it is showing three dots and onclick a toast msg which contains the actual value. – Ajay Sharma Feb 12 '15 at 10:36
  • Can u post image, how your layout should look like ? – Hardik Trivedi Feb 12 '15 at 10:39
  • `list children not appearing in one line` Now it appears on one line. The exceeding part is cut out and the three dots (ellipsis) mean that the text continues. What did you have in mind, instead? – Phantômaxx Feb 12 '15 at 10:54
  • @DerGolem means at least 1 0r 2 character of start should be displayed there. – Ajay Sharma Feb 12 '15 at 15:47
  • @HardikTrivedi i don't have 10 reputation. – Ajay Sharma Feb 12 '15 at 16:02
  • You can post a link to the picture. Someone will put it in your question, then. – Phantômaxx Feb 12 '15 at 16:27
  • @DerGolem Thnq fr trick ..I m new here. http://i.stack.imgur.com/xg7fk.png 2. http://i.stack.imgur.com/sSO8Q.png – Ajay Sharma Feb 12 '15 at 16:33
  • @HardikTrivedi I have attached the link with my last comment – Ajay Sharma Feb 12 '15 at 17:15
  • Got the Solution here-[Solution](http://stackoverflow.com/questions/6492074/why-does-textview-in-single-line-elipsized-with-end-show-boxes) Thanks @DerGolem for hint and hardik for your time. – Ajay Sharma Feb 12 '15 at 17:47

0 Answers0