List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:aierjun.com.aierjunlibrary.widget.tablayout.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); // v.setBackgroundDrawable(tabBackgroundDrawable); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); if (i == 0) tab.setTextColor(tabchecktextcolor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from w w w .ja va2 s . c om } } } }
From source file:com.benefit.buy.library.viewpagerindicator.PagerSlidingTabStrip.java
@SuppressLint("NewApi") private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//w w w . ja va 2 s . c om } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); } } else { View vImg = v.findViewById(R.id.img_click); View vText = v.findViewById(R.id.tab_name); if (vText instanceof TextView) { TextView tab = (TextView) vText; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } if (vImg instanceof ImageView) { ImageView img = (ImageView) vImg; if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { if ((i == selectedPosition) || (i == (selectedPosition + 1)) || (i == (selectedPosition - 1))) { // tab.setTextColor(selectedTabTextColor); img.setAlpha(0f); img.setVisibility(View.VISIBLE); } else { img.setVisibility(View.INVISIBLE); } } else { if ((i == selectedPosition)) { // tab.setTextColor(selectedTabTextColor); img.setVisibility(View.VISIBLE); } else { img.setVisibility(View.INVISIBLE); } } } } } }
From source file:com.itheima.googlemarket.PagerSlidingTabStrip.java
@SuppressWarnings("deprecation") private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); // StateListDrawable?????. StateListDrawable selector = createSelector(tabBackgroundPressed, tabBackgroundNormal); v.setBackgroundDrawable(selector); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); tab.setPadding(tabPadding, 0, tabPadding, 0); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//w w w . j av a2s.co m } } } }
From source file:com.dimasdanz.kendalipintu.usermodel.UserDialogManager.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); final ArrayList<String> userData = new ArrayList<String>(); final View view = inflater.inflate(R.layout.dialog_user_form, null); final TextView txtUserID = (TextView) view.findViewById(R.id.txtUserID); final EditText txtUsername = (EditText) view.findViewById(R.id.txtUserName); final EditText txtUserPass = (EditText) view.findViewById(R.id.txtUserPass); int btnText = R.string.action_add_account; if (!getArguments().isEmpty()) { btnText = R.string.change;//from w w w.j a v a 2s . c om txtUserID.setText(getArguments().getStringArrayList("data").get(0)); txtUsername.setText(getArguments().getStringArrayList("data").get(1)); txtUserPass.setText(getArguments().getStringArrayList("data").get(2)); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), 4); builder.setIcon(R.drawable.ic_action_group); builder.setTitle(R.string.dialog_title_userform); builder.setView(view); builder.setPositiveButton(btnText, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (txtUsername.getText().toString().length() > 0 || txtUserPass.getText().length() > 0) { userData.add(txtUserID.getText().toString()); userData.add(txtUsername.getText().toString()); userData.add(txtUserPass.getText().toString()); mListener.onDialogPositiveClick(UserDialogManager.this, userData); } else { //TODO Change string, use a better listener Toast.makeText(getActivity(), "Please fill all field", Toast.LENGTH_SHORT).show(); } } }); builder.setNegativeButton(R.string.delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (txtUserID.getText().toString().length() > 0) { userData.add(txtUserID.getText().toString()); mListener.onDialogNegativeClick(UserDialogManager.this, userData); } else { //TODO Change string, use a better listener Toast.makeText(getActivity(), "Please fill all field", Toast.LENGTH_SHORT).show(); } } }); builder.setNeutralButton(R.string.close, null); return builder.create(); }
From source file:PagerSlidingTab.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setLayoutParams(defaultTabLayoutParams); v.setBackgroundResource(tabBackgroundResId); if (shouldExpand) { v.setPadding(0, 0, 0, 0);// w ww .j a v a2s .c om } else { v.setPadding(tabPadding, 0, tabPadding, 0); } if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(i == 0 ? getResources().getColor(R.color.indicator_color) : tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); } } } } }
From source file:com.cube.storm.ui.view.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { android.view.View v = tabsContainer.getChildAt(i); v.setBackgroundResource(!tabSwitch ? tabBackgroundResId : transparentColorId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabSwitch && i != 0 ? tabDeactivateTextColor : tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from www . jav a 2 s . co m*/ } } else if (v instanceof ImageButton) { ImageButton tab = (ImageButton) v; tab.setSelected(tabSwitch && i == 0 ? true : false); } } }
From source file:cm.aptoide.pt.ManageRepos.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); TextView selectedView = (TextView) ((View) (info.targetView)).findViewById(R.id.uri); final String repo_selected = selectedView.getText().toString(); popupOptions popupOption = popupOptions.values()[item.getItemId()]; switch (popupOption) { case EDIT_REPO: validateRepo(repo_selected, true); refreshReposList();// ww w .ja v a 2 s. c o m break; case REMOVE_REPO: AlertDialog.Builder builder = new AlertDialog.Builder(theme); builder.setTitle(getString(R.string.remove_repo)); builder.setIcon(R.drawable.ic_menu_close_clear_cancel); builder.setMessage(getString(R.string.remove_repo_confirm) + " " + repo_selected + " ?"); builder.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { removeDisplayRepo(repo_selected.hashCode()); alert3.dismiss(); refreshReposList(); } }); builder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { alert3.dismiss(); return; } }); alert3 = builder.create(); alert3.show(); break; default: break; } return super.onContextItemSelected(item); }
From source file:com.easemob.easeui.widget.viewpagerindicator.PagerSlidingTabStrip.java
public void initTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); tab.setTextColor(tabTextColor); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }//from w ww .j a v a 2 s .co m } if (i == selectedPosition) { tab.setTextColor(selectedTabTextColor); if (oldTab != null) { oldTab.setSelected(false); ((TextView) oldTab).setTextColor(tabTextColor); } oldTab = tab; tab.setSelected(true); } } } }
From source file:de.da_sense.moses.client.FormFragment.java
/** * Displays a multiple choice question to the user. * @param question the question to be displayed * @param linearLayoutInsideAScrollView the view to add the question to * @param ordinal the ordinal number of the question i.e. 1, 2, 3, 4 or 5 *///from w w w . jav a 2s . co m private void makeMultipleChoice(final Question question, LinearLayout linearLayoutInsideAScrollView, int ordinal) { LinearLayout questionContainer = generateQuestionContainer(linearLayoutInsideAScrollView); String questionText = question.getTitle(); List<PossibleAnswer> possibleAnswers = question.getPossibleAnswers(); Collections.sort(possibleAnswers); TextView questionView = new TextView(getActivity()); questionView.setText(ordinal + ". " + questionText); if (question.isMandatory()) questionView.setTextAppearance(getActivity(), R.style.QuestionTextStyleMandatory); else questionView.setTextAppearance(getActivity(), R.style.QuestionTextStyle); questionContainer.addView(questionView); mQuestionTitleMappings.put(question, questionView); Log.i(LOG_TAG, "questionView = " + questionView.getText()); final HashSet<String> madeAnswers = new HashSet<String>(); madeAnswers.addAll(Arrays.asList(question.getAnswer().split(","))); madeAnswers.remove(""); // paranoia final CheckBox[] checkBoxs = new CheckBox[possibleAnswers.size()]; for (int i = 0; i < checkBoxs.length; i++) { final PossibleAnswer possibleAnswer = possibleAnswers.get(i); final String possibleAnswerId = String.valueOf(possibleAnswer.getId()); checkBoxs[i] = new CheckBox(getActivity()); if (i % 2 == 0) checkBoxs[i].setBackgroundColor(getActivity().getResources().getColor(R.color.light_gray)); checkBoxs[i].setText(possibleAnswer.getTitle()); checkBoxs[i].setTextAppearance(getActivity(), R.style.PossibleAnswerTextStyle); if (madeAnswers.contains(possibleAnswerId)) checkBoxs[i].setChecked(true); // click handling checkBoxs[i].setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) madeAnswers.add(possibleAnswerId); else madeAnswers.remove(possibleAnswerId); String newAnswer = ""; for (String madeAnswer1 : madeAnswers) newAnswer = newAnswer + "," + madeAnswer1; if (!newAnswer.isEmpty()) newAnswer = newAnswer.substring(1); // remove the leading "," question.setAnswer(newAnswer); } }); checkBoxs[i].setVisibility(View.VISIBLE); if (mBelongsTo == WelcomeActivityPagerAdapter.TAB_HISTORY) checkBoxs[i].setEnabled(false); questionContainer.addView(checkBoxs[i]); } }
From source file:cn.edu.qzu.face.PagerSlidingTabStrip.java
private void updateTabStyles() { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); // v.setBackgroundResource(tabBackgroundResId); if (v instanceof TextView) { TextView tab = (TextView) v; tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); tab.setTypeface(tabTypeface, tabTypefaceStyle); // tab.setTextColor(tabTextColor); tab.setTextColor(tabTextColorStateList); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (textAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab.setAllCaps(true); } else { tab.setText(tab.getText().toString().toUpperCase(locale)); }/*from w w w.j a v a 2 s. c om*/ } } } }