本文整理了Java中android.widget.TextView.setOnGenericMotionListener()
方法的一些代码示例,展示了TextView.setOnGenericMotionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setOnGenericMotionListener()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setOnGenericMotionListener
暂无
代码示例来源:origin: stackoverflow.com
public class MyActivity extends Activity implements OnGenericMotionListener {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView myView = new TextView(this);
myView.setOnGenericMotionListener(this);
}
@Override
public boolean onGenericMotion(View view, MotionEvent event) {
return false;
}
}
代码示例来源:origin: bitcraze/crazyflie-android-client
@Override
protected View onCreateDialogView() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
LinearLayout layout = new LinearLayout(getContext());
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(6,6,6,6);
TextView promptTextView = new TextView(getContext());
promptTextView.setText(R.string.preferences_axis_mapping_dialog_text);
promptTextView.setGravity(Gravity.CENTER_HORIZONTAL);
mValueTextView = new TextView(getContext());
mValueTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
mValueTextView.setGravity(Gravity.CENTER_HORIZONTAL);
mValueTextView.setPadding(0, 12, 0, 12);
mValueTextView.setOnGenericMotionListener(this);
//TODO: is there an easier way to make this work?
//motion events are not captured when view is not focusable
mValueTextView.setFocusableInTouchMode(true);
//if focus is not set, right analog stick events are only recognized after the left analog stick is moved!?!
mValueTextView.requestFocus();
layout.addView(promptTextView, params);
layout.addView(mValueTextView, params);
return layout;
}
内容来源于网络,如有侵权,请联系作者删除!