2 x TextViews inside one view,

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

2 x TextViews inside one view,

Postby javai » Fri Oct 09, 2009 1:35 am

Just stumbled across a strange problem

I have 2 textviews (multi line), they're displayed inside an AlertDialog - However only one shows.., the other one doesnt appear.. (unless the 1st textView's text is reduced to 1line/less)

This is my code XML

Code: Select all

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/layout_root"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:padding="10dp"
              android:background ="#FFF"
              android:lines ="20"
              android:minHeight = "500px"
              >

    <TextView android:id="@+id/text"
             android:textColor = "#000000"
             android:layout_width = "wrap_content"
             android:layout_height = "wrap_content"
             android:lines ="10"
              />
                  <TextView android:id="@+id/text2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:textColor = "#000000"
               android:lines ="3"
              />
             
       
</LinearLayout>




And the Java is ..


Code: Select all
                AlertDialog.Builder builder;
      AlertDialog alertDialog;
      
      LayoutInflater factory = LayoutInflater.from(this);
            
      View layoutx = factory.inflate(R.layout.test,
                (ViewGroup) findViewById(R.id.layout_root));

      TextView text2 = (TextView) layoutx.findViewById(R.id.text2);
   
      link.setText("asdjflkajsldkfj jhgjhgjhgjhgjhgggggggggggggggggggggggg gggggggggggggggggggggggggggggggg ggggggggggg glkasjdflkajsdlkf jalksdjflkasjd");
      
      TextView text = (TextView) layoutx.findViewById(R.id.text);
      text.setText("skdjfalksjdflk2222222222 skdjfalksjdflk2222222222 skdjfalksjdflk2222222222 skdjfalksjdflk2222222222 skdjfalksjdflk2222222222");

      builder = new AlertDialog.Builder(this);
      builder.setView(layoutx);
      builder.setTitle(feed.getItem(position).getTitle());
      builder.setIcon(0);
      alertDialog = builder.create();
      alertDialog.show();



Any ideas, on what ive missed?? Can anyone else replicate this?
Cheers
javai
Freshman
Freshman
 
Posts: 8
Joined: Sun Sep 13, 2009 11:52 pm

Top

Postby javai » Fri Oct 09, 2009 10:12 am

Seems like a simple enough problem? anybody? please...!!
javai
Freshman
Freshman
 
Posts: 8
Joined: Sun Sep 13, 2009 11:52 pm

Postby blackgin » Fri Oct 09, 2009 12:28 pm

You must add android:orientation="vertical" in the layout, to communicate that you want layout objects to dispose vertically..
User avatar
blackgin
Developer
Developer
 
Posts: 33
Joined: Tue Apr 21, 2009 1:21 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 8 guests