0

私が導入しようとしているこの問題は、Android 4.0 でのみ発生します +
4 つの TableLayout を持つ LinearLayout があり、その親は ScrollView です。TableRows を各 TableLayout に動的に追加します。

私のTableRowsはこのようなものです。

<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tableRow1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/borda"
    android:layout_margin="10dip"
    android:paddingLeft="10dip"
    >
  <LinearLayout
    android:id="@+id/l1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_marginTop="15dip"
    android:layout_marginBottom="15dip"
    >

    <TextView
        android:id="@+id/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/nome"
        android:textStyle="bold"
        android:textColor="#526691"
        android:textSize="15sp"
        android:paddingLeft="10dip"
        android:paddingRight="5dip"
         />


       <EditText
        android:id="@+id/valorLabel"
        android:layout_width="140dip"
        android:layout_height="wrap_content"
        android:textSize="15sp" 
        android:background="#ffffffff"   
        android:singleLine="true"   
        android:inputType="textCapSentences" 
         android:textColor="#777777" />          


 </LinearLayout>

</TableRow>

フォーカスされた EditText が画面外にスクロールされると問題が発生するようです。

質問 EditText が画面に表示されているかどうかを知るにはどうすればよいですか? 親がスクロールされている場合、EditText でフォーカスを削除する方法はありますか?

2 番目の質問
EditText にフォーカスがあると、TableRow の背景が白くなるのはなぜですか?

4

1 に答える 1

1

最初の質問の答えは次のとおりです: Android: ScrollView 内のビューが表示されているかどうかを確認する方法は?

2 つ目は、親ビューで OnTouchListener を設定できます。スクロールすると、x または y の値が変化し、EditText で clearFocus() を実行します。これは良いリファレンスです。タッチ イベント リスナーの部分を確認してください: http://www.techotopia.com/index.php/Android_Touch_and_Multi-touch_Event_Handling

ソース コードとエラー ログを記載すると、より具体的な回答が得られます。

于 2013-05-03T20:11:14.823 に答える