0

私はスクロール可能なアクティビティを含むAndroidアプリを開発しようとしていますが、アクティビティ内にはスクロール可能にしたい2つのtextViewがあります。

私の問題は、textView の内部に触れるとスクロールが表示されるが、linearLayout である主なアクティビティ部分がフォーカスを直接スチールし、textView のスクロールではなくなることです。

私が今持っている方法は、私がそれを行ったxmlファイルをスクロールするようにtextViewをセットアップすることです。そして、指を上げ続けて画面に戻してtextViewをスクロールしようとすると、少し移動できますが、前述のように、textViewを含むレイアウトがフォーカスをキャプチャし、textViewをスクロールできなくなります。

私の問題をうまく説明できたことを願っています。

役立つ提案をしてください。


アプリがどのように構築されるかを説明させてください最初の最初の部分は次のとおりです。メイン(最初の)アクティビティは、スクロール可能として定義したtabHostです

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" > 
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >   
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="422dp" >
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="63dp" >
</TabWidget>
</LinearLayout>
</ScrollView>
</TabHost>

私が問題を抱えているのはこの活動です

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

android:baselineAligned="false">

<LinearLayout 
android:id="@+id/linearLayout3" 
android:orientation="vertical" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_weight="0.04">

<TextView 
android:textAppearance="?android:attr/textAppearanceLarge" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:textColor="@color/black_color" 
android:layout_gravity="center_horizontal" 
android:text="@string/display_label" 
android:id="@+id/display_label">
</TextView>

</LinearLayout>


<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.83"
android:baselineAligned="false"
android:orientation="horizontal" >


<ScrollView
android:id="@+id/english_scrollView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.03" >

<TextView
android:id="@+id/display_english_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2px"
android:layout_marginRight="2px"
android:layout_weight="0.03"
android:background="@drawable/black_rectangle"
android:focusable="true"
android:paddingLeft="2px"
android:paddingRight="2px"
android:scrollbars="vertical"
android:textColor="@color/black_color" />

</ScrollView>


<ScrollView
android:id="@+id/translation_scrollView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.03" >

<TextView
android:id="@+id/display_translation_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2px"
android:layout_marginRight="2px"
android:layout_weight="0.03"
android:background="@drawable/black_rectangle"
android:focusable="true"
android:paddingLeft="2px"
android:paddingRight="2px"
android:scrollbars="vertical"
android:textColor="@color/black_color" />

</ScrollView>
</LinearLayout>

</LinearLayout>
4

2 に答える 2

0

私はあなたが<ScrollView>最初のxmlを切り取るべきだと思います

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >   
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="422dp" >
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="63dp" >
</TabWidget>
</LinearLayout>
</TabHost>
于 2012-02-10T02:17:28.590 に答える