1

ScrollView 内にある TextView で垂直スクロールを有効にしました (水平にスクロールするときに他のコンテンツを上に残すため) - ただし、垂直スクロールは TextView のデータにリンクがある場合にのみ機能します。url/email/etc がない場合、垂直スクロールは機能しません。

それが機能すると、垂直スクロールバーも間違ったスクロール位置を報告します-ビューで100%スクロールすると、画面の最大5%になります。

これは、この奇妙な動作を引き起こす問題のある xml レイアウトです。newsreader_messageは、適切にスクロールできるようにしたいものです。

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

<TextView
    android:id="@+id/newsreader_subjectdate"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:marqueeRepeatLimit="1"
    android:scrollHorizontally="true"
    android:text=""
    android:textAppearance="?android:attr/textAppearanceSmall" />

<TextView
    android:id="@+id/newsreader_fromto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:marqueeRepeatLimit="1"
    android:scrollHorizontally="true"
    android:text=""
    android:textAppearance="?android:attr/textAppearanceSmall" />

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/newsreader_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:autoLink="web|email"
        android:contentDescription="News post content"
        android:keepScreenOn="true"
        android:paddingRight="10dp"
        android:paddingTop="6dp"
        android:scrollHorizontally="true"
        android:scrollbars="horizontal|vertical"
        android:text=""
        android:textSize="11.5sp"
        android:typeface="monospace" />
</ScrollView>

追加の詳細として、垂直スクロールが壊れているときもマーキーはスクロールしません (マーキーはスクロールする必要があります)。

4

2 に答える 2

0

textview の layout_width を「fill_parent」に変更して、一度試してください

于 2012-04-16T03:39:44.360 に答える
0

ScrollViews レイアウトは wrap_content である必要があります。別のオプションは、以下のようにスクロールビューにスクロールを実行させ、テキストビューでスペースを埋めることです。

<ScrollView     android:id="@+id/scrollView1"    
 android:layout_width="wrap_content"    
 android:layout_height="wrap_content" 
android:scrollHorizontally="true"         
android:scrollbars="horizontal|vertical" 
android:fillViewport="true" >      
    <TextView         
android:id="@+id/newsreader_message"         
android:layout_width=""fill_parent"        
 android:layout_height="fill_parent"         
android:autoLink="web|email"         
android:contentDesciption="News post content"        
 android:keepScreenOn="true"         
android:paddingRight="10dp"         
android:paddingTop="6dp"                
  android:text=""        
 android:textSize="11.5sp"        
 android:typeface="monospace"  
android:layout_weight="1.0" /> 
</ScrollView> 
于 2012-04-16T03:58:58.210 に答える