我正在尝试使用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
无效。
请帮帮我。
答案 0 :(得分:0)
确定。我没有答案。但这就是我解决的方式,以防万一其他人想要它。
我使用了屏幕像素,然后计算了视图所需的像素。然后添加相同的
android:layout_height
属性,它对我有用。