2016-05-27 10 views
0

enter image description hereアンドロイドで静的テキストと横スクロールでリストビューを作成することはできますか?

ここで最初のテキストは固定されます。残りのアイテムについては、水平スクロールが必要で、スクロールするリスト行全体を左右にスクロールする必要があります。私たちはアンドロイドの簡単なリストビューでこれを行うことができますか?

+0

RecyclerviewまたはTwoWayView @ Anand Asirを使用することができます。 – Lampard

答えて

0

LinearLayoutsをリストビューに置き換えます。 2番目のListViewをHorizo​​ntalScrollViewの中に配置するのがアイデアです。

<xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     tools:context="com.idokov.layouttests.MainActivity"> 

     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true"> 

      <LinearLayout 
       android:orientation="vertical" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_marginRight="5dp"> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="What is Lorem Ipsum?" /> 
      </LinearLayout> 


      <HorizontalScrollView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

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

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:singleLine="true" 
         android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum." /> 
       </LinearLayout> 

      </HorizontalScrollView> 

     </LinearLayout> 
    </RelativeLayout> 
+0

同じことをやってみました。しかし、そのスクロールは個々の行だけです。私は右の部分全体をスクロールする必要があります..最初の行から最後の行に、通常の上下のリストビューのスクロールが必要です。 –

関連する問題