List of usage examples for android.widget TextView setTextAppearance
@Deprecated public void setTextAppearance(Context context, @StyleRes int resId)
From source file:android.support.v7.testutils.TestUtilsActions.java
/** * Sets text appearance on {@code TextView}. *//*w w w . jav a 2 s . c o m*/ public static ViewAction setTextAppearance(final int resId) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return allOf(isDisplayingAtLeast(90), isAssignableFrom(TextView.class)); } @Override public String getDescription() { return "TextView set text appearance"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); TextView textView = (TextView) view; textView.setTextAppearance(textView.getContext(), resId); uiController.loopMainThreadUntilIdle(); } }; }
From source file:com.ouyangzn.github.utils.UiUtils.java
public static TextView setCenterTitle(Toolbar toolbar, String title) { TextView titleView = new TextView(toolbar.getContext()); titleView.setGravity(Gravity.CENTER); titleView.setTextAppearance(toolbar.getContext(), R.style.Toolbar_titleTextAppearance); titleView.setSingleLine();//w ww .ja va 2s . com titleView.setEllipsize(TextUtils.TruncateAt.END); titleView.setText(title); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); titleView.setLayoutParams(params); Toolbar.LayoutParams lp = new Toolbar.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); lp.gravity = Gravity.CENTER; toolbar.addView(titleView, lp); return titleView; }
From source file:com.dvdprime.mobile.android.adapter.DocumentSuggestionsAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { TextView tv1 = (TextView) view.findViewById(android.R.id.text1); tv1.setText(cursor.getString(cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1))); TextView tv2 = (TextView) view.findViewById(android.R.id.text2); tv2.setTextAppearance(context, R.style.DarkGrayBaseSmallText); tv2.setText(cursor.getString(cursor.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_2))); }
From source file:com.medisa.myspacecal.StickyFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_content, container, false); mObservableScrollView = (ObservableScrollView) rootView.findViewById(R.id.scroll_view); mObservableScrollView.setCallbacks(this); mStickyView = (TextView) rootView.findViewById(R.id.sticky); mStickyView.setText(R.string.sticky_item); mPlaceholderView = rootView.findViewById(R.id.placeholder); mObservableScrollView.removeAllViews(); Intent mioIntent = getActivity().getIntent(); nSatelliti = mioIntent.getStringExtra("satelliti").split(","); Log.e("EXTRA", mioIntent.getStringExtra("satelliti")); for (int i = 0; i < nSatelliti.length; i++) { if (nSatelliti[i] != "null") { }/*from ww w . ja va 2 s . c o m*/ } TextView a = new TextView(MainActivity.ctx); a.setTextAppearance(getActivity().getApplicationContext(), R.style.Item_Bottom); mObservableScrollView.addView(a); TextView b = new TextView(MainActivity.ctx); b.setTextAppearance(getActivity().getApplicationContext(), R.style.Item_Bottom); mObservableScrollView.addView(b); mObservableScrollView.getViewTreeObserver() .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { onScrollChanged(); } }); return rootView; }
From source file:org.uguess.android.sysinfo.NetStateManager.java
static void showIpInfo(final IpInfo info, final Activity context) { if (info != null && !TextUtils.isEmpty(info.latitude) && !TextUtils.isEmpty(info.longitude)) { OnClickListener listener = new OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent it = new Intent(Intent.ACTION_VIEW); it.setData(Uri.parse("geo:0,0?q=" //$NON-NLS-1$ + info.latitude + "," //$NON-NLS-1$ + info.longitude + "&z=8")); //$NON-NLS-1$ it = Intent.createChooser(it, null); context.startActivity(it); }/*from w w w. j a v a 2s. c om*/ }; TextView txt = new TextView(context); txt.setPadding(15, 0, 15, 0); txt.setTextAppearance(context, android.R.style.TextAppearance_Medium); txt.setText(Html.fromHtml(context.getString( R.string.location_info, info.ip, info.host == null ? "" //$NON-NLS-1$ : ("<a href=\"http://" //$NON-NLS-1$ + info.host + "\">" //$NON-NLS-1$ + info.host + "</a><br>"), //$NON-NLS-1$ info.country == null ? "" : info.country, //$NON-NLS-1$ info.region == null ? "" : info.region, //$NON-NLS-1$ info.city == null ? "" : info.city))); //$NON-NLS-1$ txt.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(context).setTitle(R.string.ip_location) .setPositiveButton(R.string.view_map, listener).setNegativeButton(R.string.close, null) .setView(txt).create().show(); } else { Util.shortToast(context, R.string.no_ip_info); } }
From source file:pl.bcichecki.rms.client.android.dialogs.DeviceReservationsDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (device == null) { throw new IllegalStateException("Device has not been set!"); }//w w w. j a v a2 s. co m if (events == null) { throw new IllegalStateException("Events have not been set!"); } AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); dialogBuilder.setTitle(getString(R.string.dialog_device_reservations_title, device.getName())); if (events.size() < 1) { dialogBuilder.setMessage(R.string.dialog_device_reservations_empty); } else { StringBuilder reservations = new StringBuilder(); int counter = 1; for (Event event : events) { StringBuilder reservation = new StringBuilder(); reservation.append(counter).append(". "); reservation.append(AppUtils.getFormattedDateAsString(event.getStartDate(), Locale.getDefault())); reservation.append(" - "); reservation.append(AppUtils.getFormattedDateAsString(event.getEndDate(), Locale.getDefault())); reservation.append(" (").append(event.getTitle()).append(")"); reservation.append("\n"); reservations.append(reservation); counter++; } TextView reservationsTextView = new TextView(getActivity()); reservationsTextView.setTextAppearance(getActivity(), android.R.attr.textAppearanceSmall); reservationsTextView.setText(reservations); dialogBuilder.setView(reservationsTextView); } dialogBuilder.setPositiveButton(R.string.general_back, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { DeviceDetailsDialog deviceDetailsDialog = new DeviceDetailsDialog(); deviceDetailsDialog.setDevice(device); deviceDetailsDialog.show(getFragmentManager(), getTag()); } }); return dialogBuilder.create(); }
From source file:me.diskstation.ammon.gpsrunner.ui.RunDetailsFragment.java
private void setUpTextView(TextView tv, int index) { tv.setTextAppearance(context, R.style.TextAppearance_AppCompat_Medium); //tv.setBackgroundColor(LineColors.getLighterColor(index)); tv.setTextColor(LineColors.getColor(index)); tv.setGravity(Gravity.RIGHT);/*from w ww. j a va2 s. c o m*/ }
From source file:com.mappn.gfan.common.util.Utils.java
/** * Search Tab??TextViewView// w w w. j ava 2s .com */ public static View createSearchTabView(Context context, String text) { TextView view = (TextView) LayoutInflater.from(context).inflate(R.layout.common_tab_view, null); view.setBackgroundResource(R.drawable.search_tab_selector); view.setTextAppearance(context, R.style.search_tab_text); view.setText(text); return view; }
From source file:org.steveleach.scoresheet.ui.PlayersFragment.java
private void addHeader(String text, TableRow headers, int width) { TextView view = new TextView(activity); view.setTextAppearance(activity, R.style.gameReportTextStyle); view.setText(text);/* w w w.jav a2 s .co m*/ view.setWidth(width); headers.addView(view); }
From source file:com.nikhilnayak.games.octoshootar.TutoActivity.java
@Override public View makeView() { TextView textView = new TextView(this); textView.setTextAppearance(this, android.R.style.TextAppearance_Holo_Large); textView.setTextColor(getResources().getColor(R.color.holo_dark_green)); textView.setGravity(Gravity.CENTER); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); textView.setLayoutParams(layoutParams); return textView; }