本文整理匯總了Java中android.widget.TextView類的典型用法代碼示例。如果您正苦於以下問題:Java TextView類的具體用法?Java TextView怎麽用?Java TextView使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TextView類屬於android.widget包,在下文中一共展示了TextView類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getView
import android.widget.TextView; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_viewpager, parent, false);
holder = new ViewHolder();
holder.ivBanner = (ImageView) convertView.findViewById(R.id.ivBanner);
holder.tvName = (TextView) convertView.findViewById(R.id.tvName);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
int picSrcId = mHeroes.get(position).imageSrc;
holder.tvName.setText(mHeroes.get(position).info);
holder.ivBanner.setImageResource(picSrcId);
return convertView;
}
示例2: onPreExecute
import android.widget.TextView; //導入依賴的package包/類
@Override
protected void onPreExecute() {
isFinalizing = true;
recordFinish = true;
runAudioThread = false;
//創建處理進度條
creatingProgress = new Dialog(FFmpegRecorderActivity.this, R.style.Dialog_loading_noDim);
Window dialogWindow = creatingProgress.getWindow();
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
lp.width = (int) (getResources().getDisplayMetrics().density * 240);
lp.height = (int) (getResources().getDisplayMetrics().density * 80);
lp.gravity = Gravity.CENTER;
dialogWindow.setAttributes(lp);
creatingProgress.setCanceledOnTouchOutside(false);
creatingProgress.setContentView(R.layout.activity_recorder_progress);
progress = (TextView) creatingProgress.findViewById(R.id.recorder_progress_progresstext);
bar = (ProgressBar) creatingProgress.findViewById(R.id.recorder_progress_progressbar);
creatingProgress.show();
//txtTimer.setVisibility(View.INVISIBLE);
//handler.removeCallbacks(mUpdateTimeTask);
super.onPreExecute();
}
示例3: updateTabStyles
import android.widget.TextView; //導入依賴的package包/類
private void updateTabStyles() {
for (int i = 0; i < mTabCount; i++) {
View v = mTabsContainer.getChildAt(i);
// v.setPadding((int) mTabPadding, v.getPaddingTop(), (int) mTabPadding, v.getPaddingBottom());
TextView tv_tab_title = (TextView) v.findViewById(R.id.tv_tab_title);
if (tv_tab_title != null) {
tv_tab_title.setTextColor(i == mCurrentTab ? mTextSelectColor : mTextUnselectColor);
tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextsize);
tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
if (mTextAllCaps) {
tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase());
}
if (mTextBold == TEXT_BOLD_BOTH) {
tv_tab_title.getPaint().setFakeBoldText(true);
} else if (mTextBold == TEXT_BOLD_NONE) {
tv_tab_title.getPaint().setFakeBoldText(false);
}
}
}
}
示例4: prepareUI
import android.widget.TextView; //導入依賴的package包/類
/**
* 準備UI
*/
private void prepareUI() {
mNavigationViewRed = (NavigationViewPush) findViewById(R.id.nav_user_info);
mPortraitImageView = (SimpleDraweeView) findViewById(R.id.sdv_user_info_portrait);
mUsernameTextView = (TextView) findViewById(R.id.tv_user_info_username);
mGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_groupname);
mPointsTextView = (TextView) findViewById(R.id.tv_user_info_points);
mModifyInfoLayout = findViewById(R.id.rl_user_info_modify_info_layout);
mModifySafeInfoLayout = findViewById(R.id.rl_user_info_modify_safe_info_layout);
mRegisterTimeTextView = (TextView) findViewById(R.id.tv_user_info_registertime);
mMyPointsTextView = (TextView) findViewById(R.id.tv_user_info_mypoints);
mMyGroupNameTextView = (TextView) findViewById(R.id.tv_user_info_mygroupname);
mLogoutButton = (Button) findViewById(R.id.btn_user_info_logout);
mNavigationViewRed.setupNavigationView(true, false, "我的資料", new NavigationViewPush.OnClickListener() {
@Override
public void onBackClick(View v) {
finish();
}
});
mModifyInfoLayout.setOnClickListener(this);
mModifySafeInfoLayout.setOnClickListener(this);
mLogoutButton.setOnClickListener(this);
}
示例5: OrderHolder
import android.widget.TextView; //導入依賴的package包/類
OrderHolder(View itemView) {
super(itemView);
this.view = itemView;
this.name = (TextView) itemView.findViewById(R.id.name);
this.ratingBar = (RatingBar) itemView.findViewById(R.id.rating_bar);
this.description = (TextView) itemView.findViewById(R.id.description);
this.daysOpen = (TextView) itemView.findViewById(R.id.days_open);
this.dishesCount = (TextView) itemView.findViewById(R.id.dishes_count);
this.menusCount = (TextView) itemView.findViewById(R.id.menus_count);
this.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), GetRestaurantActivity.class);
intent.putExtra(GetRestaurantActivity.RESTAURANT_ID, item.getId());
v.getContext().startActivity(intent);
}
});
}
示例6: initViews
import android.widget.TextView; //導入依賴的package包/類
private void initViews() {
left_top_view.setBackgroundColor(parametersHolder.title_color);
TextViewUtils.setTextView(left_top_view, dataAdapter.getTitleAt(0), parametersHolder.item_gravity,
parametersHolder.item_width, parametersHolder.item_padding);
leftViews.setAdapter(new LeftViewAdapter());
SingleLineLinearLayout titleChild = ((SingleLineLinearLayout) titleView.getChildAt(0));
for (int i = 0; i < dataAdapter.getTitleCount(); i++) {
TextView textView = TextViewUtils.generateTextView(titleChild.getContext(),
dataAdapter.getTitleAt(i),
parametersHolder.item_gravity,
parametersHolder.item_width,
parametersHolder.item_padding);
titleChild.addView(textView, i);
}
titleChild.setBackgroundColor(parametersHolder.title_color);
}
示例7: onCreateDialog
import android.widget.TextView; //導入依賴的package包/類
@SuppressLint("InflateParams")
public Dialog onCreateDialog() {
tgPlayRateList = generatePercent();
final View view = getActivity().getLayoutInflater().inflate(R.layout.view_toolbar_playrate_dialog, null);
this.seekBar = (SeekBar) view.findViewById(R.id.toolbar_percent_seekbar);
this.textView = (TextView) view.findViewById(R.id.toolbar_percent_textview);
this.seekBar.setMax(tgPlayRateList.size() - 1);
this.initPlayRate();
this.appendListeners(seekBar);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.toolbar_playrate_dlg_title);
builder.setView(view);
return builder.create();
}
示例8: initViews
import android.widget.TextView; //導入依賴的package包/類
private void initViews()
{
mEmailWrapper = (TextInputLayout) findViewById(R.id.user_email_wrapper_register);
mPasswordWrapper = (TextInputLayout) findViewById(R.id.user_password_wrapper);
mFirstNameWrapper = (TextInputLayout) findViewById(R.id.user_first_name_wrapper);
mLastNameWrapper = (TextInputLayout) findViewById(R.id.user_last_name_wrapper);
mConfirmWrapper = (TextInputLayout) findViewById(R.id.password_confirm_wrapper);
mVehichleTypeSpinner = (Spinner) findViewById(R.id.SpinnerVehicleType);
mRouteSpinner = (Spinner) findViewById(R.id.SpinnerRoute);
mEmaiEdit = mEmailWrapper.getEditText();
mPasswordEdit = mPasswordWrapper.getEditText();
mConfirmEdit = mConfirmWrapper.getEditText();
mFirstNameEdit = mFirstNameWrapper.getEditText();
mLastNameEdit = mLastNameWrapper.getEditText();
mRegisterBtn = (Button) findViewById(R.id.btn_signup);
mLinkLogin = (TextView) findViewById(R.id.link_login);
mRegisterBtn.setOnClickListener(this);
mLinkLogin.setOnClickListener(this);
}
示例9: ac_styTool
import android.widget.TextView; //導入依賴的package包/類
public void ac_styTool()
{
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo =getResources().getString(R.string.android_gifb);
for (int i=0;i < a.length;i++)
{
b.append(mo.replace('n', a[i])) ;
ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
manager.setText(b);
}
TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
}
示例10: initView
import android.widget.TextView; //導入依賴的package包/類
private void initView()
{
tv_sms_sender= (TextView) windowView.findViewById(R.id.tv_sms_sender);
tv_sms_content= (TextView) windowView.findViewById(R.id.tv_sms_content);
btn_sms_send= (Button) windowView.findViewById(R.id.btn_sms_send);
//將發信人和短信內容顯示在窗口中
tv_sms_sender.setText("發件人——"+sender);
tv_sms_content.setText(smsContent);
//為短信發送按鈕設置監聽器
btn_sms_send.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if (v.getId()==R.id.btn_sms_send)
{
//發送短信
sendSms();
//關閉窗口
windowManager.removeView(windowView);
}
}
});
}
示例11: ViewHolder
import android.widget.TextView; //導入依賴的package包/類
public ViewHolder(final View itemView) {
super(itemView);
tv_orderCommodityName = (TextView) itemView.findViewById(R.id.tv_orderCommodityName);
tv_orderCommodityUnit = (TextView) itemView.findViewById(R.id.tv_orderCommodityUnit);
tv_orderCommodityQuantity = (TextView) itemView.findViewById(R.id.tv_orderCommodityQuantity);
tv_orderCommodityPriceWov = (TextView) itemView.findViewById(R.id.tv_orderCommodityPriceWov);
tv_orderCommodityAmountWov = (TextView) itemView.findViewById(R.id.tv_orderCommodityAmountWov);
tv_orderCommodityRebateRate = (TextView) itemView.findViewById(R.id.tv_orderCommodityRebateRate);
tv_orderCommodityVatAmount = (TextView) itemView.findViewById(R.id.tv_orderCommodityVatAmount);
// 整個條目點擊事件
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
示例12: inject
import android.widget.TextView; //導入依賴的package包/類
public void inject(Finder finder, final T target, Object source) {
target.tvStep = (TextView) finder.castView((View) finder.findRequiredView(source, R.id
.tv_step, "field 'tvStep'"), R.id.tv_step, "field 'tvStep'");
target.checkBoxStep = (AnimCheckBox) finder.castView((View) finder.findRequiredView
(source, R.id.check_box_step, "field 'checkBoxStep'"), R.id.check_box_step,
"field 'checkBoxStep'");
target.checkBoxNotification = (AnimCheckBox) finder.castView((View) finder
.findRequiredView(source, R.id.check_box_notification, "field " +
"'checkBoxNotification'"), R.id.check_box_notification, "field " +
"'checkBoxNotification'");
target.tvPermission = (TextView) finder.castView((View) finder.findRequiredView(source, R
.id.tv_permission, "field 'tvPermission'"), R.id.tv_permission, "field " +
"'tvPermission'");
target.llContent = (LinearLayout) finder.castView((View) finder.findRequiredView(source,
R.id.ll_content, "field 'llContent'"), R.id.ll_content, "field 'llContent'");
target.checkBoxNotificationPermission = (AnimCheckBox) finder.castView((View) finder
.findRequiredView(source, R.id.check_box_notification_permission, "field " +
"'checkBoxNotificationPermission'"), R.id
.check_box_notification_permission, "field 'checkBoxNotificationPermission'");
((View) finder.findRequiredView(source, R.id.ll_notifi_permission, "method 'onClick'"))
.setOnClickListener(new DebouncingOnClickListener() {
public void doClick(View p0) {
target.onClick(p0);
}
});
}
示例13: bclick
import android.widget.TextView; //導入依賴的package包/類
public void bclick()
{
EditText et=(EditText) findViewById(R.id.mainEditText1);
String os =et.getText().toString();
char[] a = os.toCharArray();
StringBuffer b = new StringBuffer("");
String mo ="愛҉";
for (int i=0;i < a.length;i++)
{
b.append(mo.replace('愛', a[i])) ;
ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
manager.setText(b);
}
TextView t=(TextView) findViewById(R.id.mainTextView1);
t.setText(b);
}
示例14: createNewData
import android.widget.TextView; //導入依賴的package包/類
private void createNewData(ArrayList<Double> list, String type){
Random rand = new Random();
Double temp = 0.0;
if("pulse".equals(type)){
temp = 80.0 + (int)Math.round(rand.nextDouble());
}else if("temperature".equals(type)){
temp = 36.0 + rand.nextDouble();
}
// int temp = 80 + (int)Math.round(rand.nextDouble());
list.add(temp);
TextView msg = new TextView(this);
msg.setText(temp + "");
msg.setTextColor(getColorId(R.color.dark_gray));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 20, 0, 0);
params.gravity = Gravity.CENTER;
msg.setLayoutParams(params);
msg.setGravity(Gravity.CENTER);
li_result.addView(msg, 0);
tv_time.setText("경과시간 : " + time + "s");
}
示例15: NewsItemViewHolder
import android.widget.TextView; //導入依賴的package包/類
public NewsItemViewHolder(@NonNull final View itemView) {
super(itemView);
imgImageView = (ImageView) itemView.findViewById(R.id.row_item_image);
titleTextView = (TextView) itemView.findViewById(R.id.row_item_title);
typeTextView = (TextView) itemView.findViewById(R.id.row_item_type);
dateTextView = (TextView) itemView.findViewById(R.id.row_item_date);
descriptionTextView = (TextView) itemView.findViewById(R.id.row_item_description);
}