本文整理汇总了Java中android.widget.EditText.setOnTouchListener方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setOnTouchListener方法的具体用法?Java EditText.setOnTouchListener怎么用?Java EditText.setOnTouchListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setOnTouchListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_key_board);
mPasswordEt = (EditText) findViewById(R.id.editText2);
mPasswordEt.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
int inputType = mPasswordEt.getInputType();
mPasswordEt.setInputType(InputType.TYPE_NULL);
new KeyboardUtil(KeyBoardActivity.this, KeyBoardActivity.this, mPasswordEt).showKeyboard();
mPasswordEt.setInputType(inputType);
return false;
}
});
}
示例2: initWidgets
import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void initWidgets() {
super.initWidgets();
mImgContainerLayout = (LinearLayout) findViewById(R.id.kf5_feed_back_image_layout);
mETContent = (EditText) findViewById(R.id.kf5_feed_back_content_et);
mETContent.setOnTouchListener(this);
mETContent.addTextChangedListener(new ETTextWatcher());
mImgChoiceImg = (ImageView) findViewById(R.id.kf5_feed_back_choice_img);
mImgChoiceImg.setOnClickListener(this);
mParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
mParams.bottomMargin = 1;
mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
mBackImg.setOnClickListener(this);
mTVSubmit = (TextView) findViewById(R.id.kf5_right_text_view);
mTVSubmit.setOnClickListener(this);
mTVSubmit.setEnabled(false);
}
示例3: generateOneEditText
import android.widget.EditText; //导入方法依赖的package包/类
/**
* Takes care of styling the editText passed in the param.
* tag is the index of the editText.
*
* @param styleEditText
* @param tag
*/
private void generateOneEditText(EditText styleEditText, String tag) {
params.setMargins(mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2);
filters[0] = new InputFilter.LengthFilter(1);
styleEditText.setFilters(filters);
styleEditText.setLayoutParams(params);
styleEditText.setGravity(Gravity.CENTER);
styleEditText.setCursorVisible(mCursorVisible);
if (!mCursorVisible) {
styleEditText.setClickable(false);
styleEditText.setHint(mHint);
styleEditText.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
// When back space is pressed it goes to delete mode and when u click on an edit Text it should get out of the delete mode
mDelPressed = false;
return false;
}
});
}
styleEditText.setBackgroundResource(mPinBackground);
styleEditText.setPadding(0, 0, 0, 0);
styleEditText.setTag(tag);
styleEditText.setInputType(getKeyboardInputType());
styleEditText.addTextChangedListener(this);
styleEditText.setOnFocusChangeListener(this);
styleEditText.setOnKeyListener(this);
}
示例4: setClearAction
import android.widget.EditText; //导入方法依赖的package包/类
public static void setClearAction(final EditText target)
{
target.setOnTouchListener(new View.OnTouchListener()
{
final int RIGHT = 2;
@Override
public boolean onTouch(
View view,
MotionEvent event)
{
if (event.getAction() == MotionEvent.ACTION_UP) {
int leftEdgeOfRightDrawable =
view.getRight() - target.getCompoundDrawables()[RIGHT].getBounds()
.width();
// when EditBox has padding, adjust leftEdge like
// leftEdgeOfRightDrawable -= getResources().getDimension(R.dimen.edittext_padding_left_right);
if (event.getRawX() >= leftEdgeOfRightDrawable) {
// clicked on clear icon
target.setText("");
target.clearFocus();
return false;
}
}
return false;
}
});
}
示例5: setupEditText
import android.widget.EditText; //导入方法依赖的package包/类
protected void setupEditText(EditText editText) {
editText.setInputType(InputType.TYPE_NULL);
editText.setFilters(filters);
editText.setOnTouchListener(touchListener);
editText.setTransformationMethod(PasswordTransformationMethod
.getInstance());
}
示例6: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editor);
Intent intent = getIntent();
uriCurrentPet = intent.getData();
// check if it is a new pet or update pet
if (uriCurrentPet == null) {
// Insert New Pet
setTitle(getString(R.string.editor_activity_title_new_pet));
} else {
// Update Existing Pet
setTitle(getString(R.string.editor_activity_title_edit_pet));
// Initialize the Cursor Loader
getLoaderManager().initLoader(PET_LOADER, null, this);
}
// Find all relevant views that we will need to read user input from
mNameEditText = (EditText) findViewById(R.id.edit_pet_name);
mBreedEditText = (EditText) findViewById(R.id.edit_pet_breed);
mWeightEditText = (EditText) findViewById(R.id.edit_pet_weight);
mGenderSpinner = (Spinner) findViewById(R.id.spinner_gender);
// Attach the listener to track changes
mNameEditText.setOnTouchListener(mTouchListener);
mBreedEditText.setOnTouchListener(mTouchListener);
mWeightEditText.setOnTouchListener(mTouchListener);
mGenderSpinner.setOnTouchListener(mTouchListener);
setupSpinner();
}
示例7: initView
import android.widget.EditText; //导入方法依赖的package包/类
private void initView() {
try {
formWindow = new UdeskConfirmPopWindow(this);
bolckedWindow = new UdeskConfirmPopWindow(this);
gpsNetWindow = new UdeskConfirmPopWindow(this);
sendBtn = (Button) findViewById(R.id.udesk_bottom_send);
sendBtn.setOnClickListener(this);
mInputEditView = (EditText) findViewById(R.id.udesk_bottom_input);
mInputEditView.addTextChangedListener(new EditChangedListener());
mInputEditView.setOnTouchListener(this);
emojisPannel = findViewById(R.id.udesk_bottom_emojis);
showEmjoImg = findViewById(R.id.udesk_bottom_show_emoji);
showEmjoImg.setOnClickListener(this);
mEmojiAdapter = new UDEmojiAdapter(this);
emjoGridView = (GridView) findViewById(R.id.udesk_bottom_emoji_pannel);
emjoGridView.setAdapter(mEmojiAdapter);
emjoGridView.setOnItemClickListener(this);
btnCamera = findViewById(R.id.udesk_bottom_option_camera);
btnCamera.setOnClickListener(this);
btnPhoto = findViewById(R.id.udesk_bottom_option_photo);
btnPhoto.setOnClickListener(this);
btnFile = findViewById(R.id.udesk_bottom_option_file);
btnFile.setOnClickListener(this);
btnsurvy = findViewById(R.id.udesk_bottom_survy_rl);
btnsurvy.setOnClickListener(this);
if (UdeskSDKManager.getInstance().getImSetting() != null && !UdeskSDKManager.getInstance().getImSetting().getEnable_im_survey()) {
btnsurvy.setVisibility(View.GONE);
}
mListView = (UDPullGetMoreListView) findViewById(R.id.udesk_conversation);
expandableLayout = (UdeskExpandableLayout) findViewById(R.id.udesk_change_status_info);
showVoiceImg = findViewById(R.id.udesk_bottom_voice_rl);
showVoiceImg.setOnClickListener(this);
if (UdeskConfig.isUseVoice) {
showVoiceImg.setVisibility(View.VISIBLE);
} else {
showVoiceImg.setVisibility(View.GONE);
}
audioPanel = findViewById(R.id.udesk_bottom_audios);
mHorVoiceView = (HorVoiceView) findViewById(R.id.udesk_horvoiceview);
udesk_audio_tips = (TextView) findViewById(R.id.udesk_audio_tips);
audioCancle = findViewById(R.id.udesk_audio_cancle_image);
udeskImContainer = findViewById(R.id.udesk_im_container);
audioPop = (ImageView) findViewById(R.id.udesk_audio_pop);
setListView();
initDatabase();
mPresenter.createIMCustomerInfo();
isNeedRelogin = !UdeskUtils.isNetworkConnected(this);
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle data = getIntent().getExtras();
if (data.containsKey("plant")) {
currentPlant = (Plant) data.getSerializable("plant");
}
editImage = null;
if (data.containsKey("log_image")) {
editImage = data.getString("log_image");
imagePath = editImage;
}
editNote = null;
if (data.containsKey("log_notes")) {
editNote = data.getString("log_notes");
}
editDesc = null;
if (data.containsKey("log_desc")) {
editDesc = data.getString("log_desc");
}
editId = 0;
if (data.containsKey("log_id")) {
editId = data.getInt("log_id");
}
entryDescription = (EditText) findViewById(R.id.entry_description);
entryNotes = (EditText) findViewById(R.id.entry_notes);
entryImage = (ImageButton) findViewById(R.id.add_image_button);
dateCalendar = (CalendarView) findViewById(R.id.date_calendar);
setDate = new Date();
dateCalendar.setOnDateClickListener(new CalendarView.OnDateClickListener() {
@Override
public void onDateClick(Date date) {
setDate = date;
}
});
entryNotes.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK){
case MotionEvent.ACTION_UP:
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
return false;
}
});
if (editDesc != null) {
entryDescription.setText(editDesc);
}
if (editNote != null) {
entryNotes.setText(editNote);
}
if (editImage != null) {
drawable = Drawable.createFromPath(editImage);
entryImage.setImageDrawable(drawable);
}
result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
HashMap<String, Serializable> map = new HashMap<String, Serializable>();
map.put("plant", currentPlant);
setToolbarClickBackButton(PlantInfoActivity.class, map);
setTitle("Add Log Entry");
}
示例9: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
localizerManager.setPreferencesLocale(getApplicationContext());
themeManager.setPreferencesTheme(getApplicationContext(), this);
delegate = AppCompatDelegate.create(this, this);
delegate.installViewFactory();
super.onCreate(savedInstanceState);
delegate.onCreate(savedInstanceState);
delegate.setContentView(R.layout.description);
Toolbar toolbar = (Toolbar)findViewById(R.id.description_toolbar);
delegate.setSupportActionBar(toolbar);
delegate.getSupportActionBar().setLogo(R.drawable.ic_menu_edit);
delegate.setTitle(getApplicationContext().getString(R.string.description_toolbar));
delegate.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
delegate.getSupportActionBar().setDisplayShowHomeEnabled(true);
descriptionEditText = (EditText) findViewById(R.id.description_to_add);
description_accept = (Button) findViewById (R.id.description_accept);
description_cancel = (Button) findViewById (R.id.description_cancel);
Intent intent = getIntent();
if(intent.getExtras() != null)
{
recordFilename = intent.getStringExtra("recordFilename");
description = intent.getStringExtra("description");
if(!description.equals(""))
{
descriptionEditText.setText(description);
}
}
descriptionEditText.setFocusableInTouchMode(true);
descriptionEditText.setFocusable(true);
descriptionEditText.requestFocus();
descriptionEditText.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent event)
{
v.requestFocus();
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(getApplicationContext().INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
return false;
}
});
description_accept.setOnClickListener(this);
description_cancel.setOnClickListener(this);
}