1
我有一个问题,但我没有在我的搜索中得到任何答案。如何使2 TextViews可滚动而不使布局可滚动?
我正在使用1 EditText
和2 TextView
,如果TextView
的容量增加,它不会增加它,我无法使其滚动。
我需要为它们添加无限文本。
我需要两个文本视图作为可滚动。
请帮我找到解决方案。
我曾尝试:
android:maxLines = "AN_INTEGER"
android:scrollbars = "vertical"
yourTextView.setMovementMethod(new ScrollingMovementMethod());
and
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/linear1">
<ScrollView
android:id="@+id/SCROLLER_ID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:fillViewport="true">
<TextView
android:id="@+id/TEXT_STATUS_ID"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:layout_weight="1.0"/>
</ScrollView>
</LinearLayout>
mTextStatus = (TextView) findViewById(R.id.TEXT_STATUS_ID);
mScrollView = (ScrollView) findViewById(R.id.SCROLLER_ID);
private void scrollToBottom()
{
mScrollView.post(new Runnable()
{
public void run()
{
mScrollView.smoothScrollTo(0, mTextStatus.getBottom());
}
});
}
而且我想通过如果有更多的文字意味着它应该是滚动的,不知道该文本的长度只有3条线路,后来显示TextView
文本。
请帮我找到解决方案。
你肯定您r回答我需要显示我的文本只行如果任何文本添加它也应该显示3行时,更多的文本添加意味着它应该可滚动..! @BrunoFerreira –
如果你不添加文本,它不会做任何事情,因为textview没有比屏幕大小更多的文本,如果你有更多的文本比屏幕大小的文本视图变得可滚动。你可以尝试我的代码,如果你做得很好,如果不是只发送一个回复知道! @AjayJain –
如果我明白你只想显示3行,并使滚动,如果文本超过屏幕大小 –