0

我正在尝试使用 textView 显示一个文本框。我在运行时添加了一些数据。我只想让它显示一个大小为 23 行的框。

我使用的代码就是这个。

<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>

现在,当我在模拟器中看到它时,它会完美运行(Android 2.2),但是当我在真实设备(Wildfire 2.2.1)中测试相同的代码时,该框不会出现 23 行。相反,它只显示一个 5 行框。我能够滚动,但看起来像

:minLine

不管用。

请帮我。

4

1 回答 1

0

行。我没有答案。但这就是我解决的方法,以防万一其他人想要它。

我使用了屏幕像素,然后计算了视图所需的像素。然后添加相同的

android:layout_height

财产,它对我有用。

于 2011-12-11T14:03:38.370 回答