Button과 일부 TextView와 EditText가 포함 된 ScrollView 내부에 RelativeLayout이 있습니다.Android 버튼은 발사하는데 두 번 클릭하는 데 항상 걸림 onClick()
내 xml 레이아웃 파일에서 android : onClick을 정의하지만 버튼을 두 번 클릭하여 이벤트를 발생시킵니다. 버튼은 항상 첫 번째 클릭에 초점을 맞추고 두 번째 클릭시 onClick 이벤트를 발생시킵니다. focusable 및 focusableInTouchMode를 false로 설정하려고 시도했지만 동작이 변경되지 않습니다. 여기
내 레이아웃 파일 다음 포커스와 focusableIn TouchMode를 아무 짓도하지 않는 것 이유에<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".DensityActivity" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
...
<TextView
...
<TextView
...
<EditText
...
<Button
android:id="@+id/ad_button_calculate"
android:layout_width="112dp"
android:layout_height="wrap_content"
android:layout_below="@id/ad_edit_obs_temp"
android:layout_alignParentRight="true"
android:layout_marginTop="20pt"
android:paddingLeft="6pt"
android:onClick="onClick"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/button_calculate" />
<TextView
...
</RelativeLayout>
</ScrollView>
어떤 아이디어 나 제안?
내 onClick() 메소드가해야 할 일이 아닌 것 같아서 그냥보고 뭔가 간단하게 줄 였고 똑같이 동작합니다. 다음은 단순화 된 onClick()입니다.
public void onClick(View view) {
new AlertDialog.Builder(this).setTitle("Argh").setMessage("Watch out!").setNeutralButton("Close", null).show();
}
'onClick()'을 게시하십시오. 'Button'에'focusable'가 필요하지 않아야합니다. 우리가 알지 못하는 무언가가 있다면 말입니다. – codeMagic
흠, 새 프로젝트에서 같은 레이아웃을 사용하면 잘 작동합니다. 당신 말이 맞습니다. 내가 모르는 뭔가가 있어야합니다. 나는 계속 조사 할 것이다. – plisskin
프로젝트를 정리할 수 있습니다. "Project -> Clean ..." – codeMagic