本文整理匯總了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;
}
}