本文整理汇总了Java中android.widget.TextView.getId方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.getId方法的具体用法?Java TextView.getId怎么用?Java TextView.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.getId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setViewText
import android.widget.TextView; //导入方法依赖的package包/类
/**
* Se de formatear el contenido de las distintas views de la lista. Modificaremos el texto de la fecha,
* para que se vea con un formato más legible y el contendio de la nota para mostrar un preview.
* @param v vista
* @param text texto a modificar.
*/
@Override
public void setViewText(TextView v, String text) {
switch (v.getId())
{
case R.id.liNoteDate :
text = AppConstants.getStringDate(new Date(Long.parseLong(text)));
break;
case R.id.liNoteContent :
if (text.length() > 100) {
text = text.substring(0, 99);
text = text + " ... ";
}
}
super.setViewText(v, text);
}
示例2: onClick
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
for (int i = 0; i < mTabViews.size(); i++) {
TextView textView = mTabViews.get(i);
boolean isClickMe = textView.getId() == v.getId() ||
(mTabViews2 != null && mTabViews2.get(i).getId() == v.getId());
if(isClickMe){
textView.setTextColor(mSelectedTabColor);
setCurrentItem(i);
}else{
textView.setTextColor(mTabViewDefaultColor);
}
}
}
示例3: onEditorAction
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
final int id = textView.getId();
switch (id) {
case R.id.key_edittext:
if (actionId == EditorInfo.IME_ACTION_NEXT) {
_secretEditText.requestFocus();
}
return true;
case R.id.secret_edittext:
if (actionId == EditorInfo.IME_ACTION_DONE) {
updateAuthenticationSettings();
}
return true;
}
return false;
}
示例4: onEditorAction
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
switch (v.getId()) {
case R.id.etSkuNo:
// 当按了搜索之后关闭软键盘
((InputMethodManager) etSkuNo.getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
getSkuNoListByNo(etSkuNo.getText().toString());
break;
case R.id.etSkuName:
((InputMethodManager) etSkuName.getContext().getSystemService(Context.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
getSkuNoListByName(etSkuName.getText().toString());
break;
}
return true;
}
return false;
}
示例5: setViewText
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void setViewText(TextView textView, String text) {
//Set font
Typeface font = FontManager.getInstance().getFont(FontManager.Font.ROBOTO_LIGHT);
textView.setTypeface(font);
int id = textView.getId();
if (id == R.id.textView_history_date) {
setDateView(textView, text);
} else if (id == R.id.textView_history_meat) {
setMeatView(textView, text);
} else if (id == R.id.textView_history_amount) {
setAmountView(textView, text);
}
}
示例6: onEditorAction
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (v.getId() == nameView.getId() && actionId == EditorInfo.IME_ACTION_NEXT) {
phoneNumberView.requestFocus();
return true;
}
return false;
}
示例7: setViewText
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void setViewText(TextView view, String text) {
// para la duración, realizaremos un formateo
if (view.getId() == R.id.liCallDuration) {
long longVal = Long.parseLong(text);
text = AppUtils.secondsToHoutMinSecond(longVal);
}
super.setViewText(view, text);
}
示例8: onEditorAction
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (EditorInfo.IME_ACTION_SEND == actionId) {
onPushAction();
return true;
}
else
if ( (EditorInfo.IME_ACTION_SEARCH == actionId ) && ( textView.getId() == R.id.et_contract_account) ){
onContractEntered( mEtContract.getText().toString());
}
return false;
}
示例9: onEllipsizeChange
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onEllipsizeChange(TextView view, boolean ellipsized) {
switch (view.getId()) {
case R.id.text1:
view.setBackgroundColor(getResources().getColor(R.color.white));
break;
case R.id.text2:
if (!ellipsized) {
Toast.makeText(this, "ellipsized=false", Toast.LENGTH_LONG).show();
}
break;
}
}