2016-06-09 3 views
-4

У меня есть макет с 2 textView, которые расположены горизонтально. textView используется для отображения данных, которые извлекаются из базы данных sqlite, и я хочу добавить вид прокрутки в этом макете, не меняя расположение textView.plee, помогите мне, это середина.Как добавить просмотр прокрутки с помощью textview?

+0

Вы хотите сделать их горизонтальными или вертикальными? –

+0

@SomeshKumar vertical –

+0

Возможные дубликаты - http://stackoverflow.com/questions/6674341/how-to-use-scrollview-in-android –

ответ

0

Я думаю, что вы хотите этого.

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal"> 

      <TextView 
       android:id="@+id/xTv1" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1"/> 

      <TextView 
       android:id="@+id/xTv2" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1"/> 

     </LinearLayout> 

    </ScrollView> 


</LinearLayout> 
Смежные вопросы