TextViewにクリックリスナーを設定すると、最初のクリックでイベントが発生しません。これがテキストビューです:
<TextView
style="@android:style/Widget.EditText"
android:id="@+id/my_text_area"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textColorHint="@color/text_hint"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:clickable="true"
android:padding="10dip"
android:background="@android:color/transparent"
android:layout_weight="1"
></TextView>
// OnCreate:
TextView link = (TextView)findViewById(R.id.my_text_area);
// "this" is my Activity that implements OnClickListener
link.setOnClickListener(this);
void OnClick(view v) {
//only gets fired after the first time
}
テキストビューをクリックすると、次のようになります。
クリック1.テキストビューがフォーカスクリックを受け取ります2.OnClickが起動されます
私もそれを発射するために1をクリックする必要があります