2016-12-16 10 views
0

2テキストビューでテキストを水平方向にスクロールしたいとします。しかし、次のコードを使用して1つのテキストビューでのみスクロールしています。しかし、別のテキストビューはスクロールしていません。ソリューションは高く評価されています。複数のテキストビューでテキストを水平方向にスクロールする方法

<!-- language: lang-xml --> 
    <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:layout_marginRight="10dp" 
      android:layout_below="@+id/zoomableImageView" 
      android:layout_alignLeft="@+id/zoomableImageView" 
      android:layout_alignStart="@+id/zoomableImageView"> 

      <!--File Name--> 

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

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="File name: " 
        android:textColor="@color/black" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

       <TextView 
        android:id="@+id/fileName" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_weight="1" 
        android:ellipsize="marquee" 
        android:focusable="true" 
        android:focusableInTouchMode="true" 
        android:marqueeRepeatLimit="marquee_forever" 
        android:scrollHorizontally="true" 
        android:singleLine="true" 
        android:textColor="@color/gray" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

      </LinearLayout> 

      <!--File Type--> 

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

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="File type: " 
        android:textColor="@color/black" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

       <TextView 
        android:id="@+id/fileType" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:textColor="@color/gray" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

      </LinearLayout> 

      <!--File size--> 

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

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="File size: " 
        android:textColor="@color/black" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

       <TextView 
        android:id="@+id/fileSize" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:textColor="@color/gray" 
        android:textSize="12.5dp" /> 

      </LinearLayout> 

      <!--Image Resolution--> 

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

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Resolution: " 
        android:textColor="@color/black" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

       <TextView 
        android:id="@+id/imageResolution" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:textColor="@color/gray" 
        android:textSize="12.5dp" /> 

      </LinearLayout> 

      <!--Modified Date--> 

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

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Resolution: " 
        android:textColor="@color/black" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

       <TextView 
        android:id="@+id/modifiedDate" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:textColor="@color/gray" 
        android:textSize="12.5dp" /> 

      </LinearLayout> 

      <!-- File path --> 

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

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Path: " 
        android:textColor="@color/black" 
        android:textSize="12.5dp"/> 

       <TextView 
        android:id="@+id/path" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_weight="1" 
        android:ellipsize="marquee" 
        android:focusable="true" 
        android:focusableInTouchMode="true" 
        android:marqueeRepeatLimit="marquee_forever" 
        android:scrollHorizontally="true" 
        android:singleLine="true" 
        android:textColor="@color/gray" 
        android:textSize="12.5dp" 
        android:textStyle="normal" /> 

      </LinearLayout> 

ファイル名のテキストはスクロールしていますが、ファイルパスのテキストはスクロールしていません。

+0

あなたのコードは – sasikumar

+0

で今 –

+0

を参照してください@sasikumar場所ファイル名がスクロールしているが、ファイルパスがスクロールされていない参照@sasikumarそのファイル – sasikumar

答えて

0
<TextView 
android:id="@+id/tvName" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:ellipsize="marquee" 
android:fadingEdge="horizontal" 
android:marqueeRepeatLimit="marquee_forever" 
android:singleLine="true"/> 

tvName.setSelected(TRUE)。 //自動スクロール水平

関連する問題