1
當我在某些設備上按下按鈕時,它顯示E/Sensors:ProximitySensor:未知事件(type = 1,code = 330,value = 1),並且在這裏給出我的代碼。Android按鈕onClick未知事件問題
XML
<Button
android:id="@+id/button_done"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/button_clcik_efferct_blue_white_no_round"
android:text="DONE"
android:textColor="@drawable/button_clcik_efferct_text_white_blue"
android:textStyle="bold"/>
JAVA
@BindView(R.id.button_done) Button buttonDone;
@OnClick(R.id.button_done)
public void onClick(View view) {
switch (view.getId()) {
case R.id.button_done:
try {
PreferenceManager.getInstance().setLocationName(localityName);
} catch (Exception e) {
e.printStackTrace();
}
break;
}
}
這意味着某些設備是其他設備的工作? –
我認爲在問題中添加ButterKnife標記更好? – Yazan