Search code examples
androidtextviewandroid-linearlayoutandroid-scrollview

Layout displayed in Emulator is not same as in real device


I am trying to display a text box using textView.I am adding some data in it during runtime. I just want it to display a box of size 23 lines.

Code am using is this.

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <TextView
            android:id="@+id/twittertext"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:fadingEdge="vertical"
            android:maxLines="23"
            android:minLines="23"
            android:background="@drawable/dropshadow"
            android:scrollbars="vertical"
            android:text="Getting data on your slow n/w..."
            android:textColor="#ffffff"
           />
    </ScrollView>
</LinearLayout>

Now when i see this in emulator it's coming perfectly (Android 2.2) but when i test the same code in a real device (Wildfire 2.2.1) the box is not coming for 23 lines. Rather it just show a 5 line box. Am able to scroll but looks like the

:minLine

is not working.

Please help me.


Solution

  • Ok. I dont have a answer for it. But this is how i solved, just in case someone else want it.

    I have used the screen pixels and then calculated the pixels i need for the view. Then added the same as

    android:layout_height
    

    property and it worked for me.