List of usage examples for android.widget TextView setTextSize
@android.view.RemotableViewMethod public void setTextSize(float size)
From source file:fr.cph.chicago.adapter.SearchAdapter.java
@Override public final View getView(final int position, View convertView, final ViewGroup parent) { LayoutInflater vi = (LayoutInflater) ChicagoTracker.getAppContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.list_search, null); TextView rounteName = (TextView) convertView.findViewById(R.id.station_name); if (position < mTrains.size()) { final Station station = (Station) getItem(position); Set<TrainLine> lines = station.getLines(); rounteName.setText(station.getName()); LinearLayout stationColorView = (LinearLayout) convertView.findViewById(R.id.station_color); int indice = 0; for (TrainLine tl : lines) { TextView textView = new TextView(mContext); textView.setBackgroundColor(tl.getColor()); textView.setText(" "); textView.setTextSize(mContext.getResources().getDimension(R.dimen.activity_list_station_colors)); stationColorView.addView(textView); if (indice != lines.size()) { textView = new TextView(mContext); textView.setText(""); textView.setPadding(0, 0, (int) mContext.getResources().getDimension(R.dimen.activity_list_station_colors_space), 0);//from ww w. j a v a2 s. c o m textView.setTextSize( mContext.getResources().getDimension(R.dimen.activity_list_station_colors)); stationColorView.addView(textView); } indice++; } convertView.setOnClickListener( new FavoritesTrainOnClickListener(mActivity, mContainer, station.getId(), lines)); } else if (position < mTrains.size() + mBuses.size()) { final BusRoute busRoute = (BusRoute) getItem(position); TextView type = (TextView) convertView.findViewById(R.id.train_bus_type); type.setText("B"); rounteName.setText(busRoute.getId() + " " + busRoute.getName()); final TextView loadingTextView = (TextView) convertView.findViewById(R.id.loading_text_view); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadingTextView.setVisibility(LinearLayout.VISIBLE); mActivity.startRefreshAnimation(); new DirectionAsyncTask().execute(busRoute, loadingTextView); } }); } else { final BikeStation bikeStation = (BikeStation) getItem(position); TextView type = (TextView) convertView.findViewById(R.id.train_bus_type); type.setText("D"); rounteName.setText(bikeStation.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(ChicagoTracker.getAppContext(), BikeStationActivity.class); Bundle extras = new Bundle(); extras.putParcelable("station", bikeStation); intent.putExtras(extras); mActivity.startActivity(intent); mActivity.overridePendingTransition(R.anim.slide_in, R.anim.slide_out); } }); } return convertView; }
From source file:com.df.kia.carsWaiting.CarsWaitingListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cars_waiting); swipeListView = (SwipeListView) findViewById(R.id.carsWaitingList); data = new ArrayList<CarsWaitingItem>(); adapter = new CarsWaitingListAdapter(this, data, new CarsWaitingListAdapter.OnAction() { @Override/* w w w . j a v a 2s . c o m*/ public void onEditPressed(int position) { swipeListView.openAnimate(position); } @Override public void onModifyProcedure(int positon) { CarsWaitingItem item = data.get(positon); Intent intent = new Intent(CarsWaitingListActivity.this, InputProceduresActivity.class); intent.putExtra("carId", item.getCarId()); startActivity(intent); } @Override public void onDeleteCar(final int position) { View view1 = getLayoutInflater().inflate(R.layout.popup_layout, null); TableLayout contentArea = (TableLayout) view1.findViewById(R.id.contentArea); TextView content = new TextView(view1.getContext()); content.setText(R.string.confirmDeleteCar); content.setTextSize(20f); contentArea.addView(content); setTextView(view1, R.id.title, getResources().getString(R.string.alert)); AlertDialog dialog = new AlertDialog.Builder(CarsWaitingListActivity.this).setView(view1) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { CarsWaitingItem item = data.get(position); deleteCar(item.getCarId()); } }).setNegativeButton(R.string.cancel, null).create(); dialog.show(); } }); swipeListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); swipeListView.setSwipeListViewListener(new BaseSwipeListViewListener() { @Override public void onClickFrontView(int position) { getCarDetail(data.get(position).getCarId(), CarCheckActivity.class); } @Override public void onDismiss(int[] reverseSortedPositions) { for (int position : reverseSortedPositions) { data.remove(position); } adapter.notifyDataSetChanged(); } @Override public void onStartOpen(int position, int action, boolean right) { swipeListView.closeOpenedItems(); lastPos = position; } }); swipeListView.setSwipeMode(SwipeListView.SWIPE_MODE_LEFT); swipeListView.setSwipeActionLeft(SwipeListView.SWIPE_ACTION_REVEAL); swipeListView.setLongClickable(false); swipeListView.setSwipeOpenOnLongPress(false); swipeListView.setOffsetLeft(620); swipeListView.setAnimationTime(300); swipeListView.setAdapter(adapter); footerView = ((LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)) .inflate(R.layout.footer, null, false); swipeListView.addFooterView(footerView); Button homeButton = (Button) findViewById(R.id.buttonHome); homeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); Button loadMoreButton = (Button) findViewById(R.id.loadMore); loadMoreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { refresh(); } }); Button refreshButton = (Button) findViewById(R.id.buttonRefresh); refreshButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startNumber = 1; data.clear(); adapter.notifyDataSetChanged(); swipeListView.closeOpenedItems(); refresh(); } }); refresh(); }
From source file:com.example.drugsformarinemammals.ViewPager_Pinnipeds.java
private void displayMessage(String messageTitle, String message) { AlertDialog.Builder myalert = new AlertDialog.Builder(this); TextView title = new TextView(this); title.setTypeface(Typeface.SANS_SERIF); title.setTextSize(20); title.setTextColor(getResources().getColor(R.color.blue)); title.setPadding(8, 8, 8, 8);/*from www. jav a2s . c o m*/ title.setText(""); title.setGravity(Gravity.CENTER_VERTICAL); LinearLayout layout = new LinearLayout(this); TextView text = new TextView(this); text.setTypeface(Typeface.SANS_SERIF); text.setTextSize(20); text.setPadding(10, 10, 10, 10); text.setText(message); layout.addView(text); myalert.setView(layout); myalert.setCustomTitle(title); myalert.setCancelable(true); myalert.show(); }
From source file:com.starwood.anglerslong.LicenseActivity.java
private void createTextView() { if (isCreateTextViewSet) return;// w ww .j av a 2 s . c om // Get the linear layout and set the parameters LinearLayout ll = (LinearLayout) findViewById(R.id.profile_ll); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.gravity = Gravity.CENTER; TextView createLicense = new TextView(this); createLicense.setId(0); createLicense.setText(Html.fromHtml(getResources().getString(R.string.create_license_string))); createLicense.setPadding(70, 100, 70, 100); createLicense.setTextSize(18); ll.addView(createLicense, params); isCreateTextViewSet = true; }
From source file:com.googlecode.android_scripting.activity.Main.java
protected void initializeViews() { LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); layout.setGravity(Gravity.CENTER_HORIZONTAL); TextView textview = new TextView(this); textview.setText(" PhpForAndroid " + version); ImageView imageView = new ImageView(this); imageView.setImageDrawable(getResources().getDrawable(R.drawable.pfa)); layout.addView(imageView);//from w w w . j a va 2s.com mButton = new Button(this); mAboutButton = new Button(this); MarginLayoutParams marginParams = new MarginLayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); final float scale = getResources().getDisplayMetrics().density; int marginPixels = (int) (MARGIN_DIP * scale + 0.5f); marginParams.setMargins(marginPixels, marginPixels, marginPixels, marginPixels); mButton.setLayoutParams(marginParams); mAboutButton.setLayoutParams(marginParams); layout.addView(textview); layout.addView(mButton); layout.addView(mAboutButton); mProgressLayout = new LinearLayout(this); mProgressLayout.setOrientation(LinearLayout.HORIZONTAL); mProgressLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mProgressLayout.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL); LinearLayout bottom = new LinearLayout(this); bottom.setOrientation(LinearLayout.HORIZONTAL); bottom.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); bottom.setGravity(Gravity.CENTER_VERTICAL); mProgressLayout.addView(bottom); TextView message = new TextView(this); message.setText(" In Progress..."); message.setTextSize(20); message.setTypeface(Typeface.DEFAULT_BOLD); message.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); ProgressBar bar = new ProgressBar(this); bar.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); bottom.addView(bar); bottom.addView(message); mProgressLayout.setVisibility(View.INVISIBLE); layout.addView(mProgressLayout); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setProgressBarIndeterminateVisibility(false); setContentView(layout); }
From source file:cn.org.eshow.framwork.view.sliding.AbSlidingSmoothFixTabView.java
/** * ??tab.// w w w. j a v a 2 s . c o m * * @param tabTexts the tab texts * @param fragments the fragments */ public void addItemViews(List<String> tabTexts, List<Fragment> fragments) { tabItemTextList.addAll(tabTexts); pagerItemList.addAll(fragments); tabItemList.clear(); mTabLayout.removeAllViews(); for (int i = 0; i < tabItemTextList.size(); i++) { final int index = i; String text = tabItemTextList.get(i); TextView tv = new TextView(this.context); tv.setTextColor(tabColor); tv.setTextSize(tabTextSize); tv.setText(text); tv.setGravity(Gravity.CENTER); tv.setLayoutParams(new LayoutParams(0, LayoutParams.FILL_PARENT, 1)); tv.setPadding(12, 5, 12, 5); tv.setFocusable(false); tabItemList.add(tv); mTabLayout.addView(tv); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mViewPager.setCurrentItem(index); } }); } //? mFragmentPagerAdapter.notifyDataSetChanged(); mViewPager.setCurrentItem(0); computeTabImg(0); }
From source file:cn.org.eshow.framwork.view.sliding.AbSlidingSmoothFixTabView.java
/** * ??tab./*from www . java 2 s . c o m*/ * * @param tabText the tab text * @param fragment the fragment */ public void addItemView(String tabText, Fragment fragment) { tabItemTextList.add(tabText); pagerItemList.add(fragment); tabItemList.clear(); mTabLayout.removeAllViews(); for (int i = 0; i < tabItemTextList.size(); i++) { final int index = i; String text = tabItemTextList.get(i); TextView tv = new TextView(this.context); tv.setTextColor(tabColor); tv.setTextSize(tabTextSize); tv.setText(text); tv.setGravity(Gravity.CENTER); tv.setLayoutParams(new LayoutParams(0, LayoutParams.FILL_PARENT, 1)); tv.setPadding(12, 5, 12, 5); tv.setFocusable(false); tabItemList.add(tv); mTabLayout.addView(tv); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mViewPager.setCurrentItem(index); } }); } //? AbLogUtil.d(AbSlidingSmoothFixTabView.class, "addItemView finish"); mFragmentPagerAdapter.notifyDataSetChanged(); mViewPager.setCurrentItem(0); computeTabImg(0); }
From source file:com.bangqu.eshow.view.sliding.ESSlidingSmoothFixTabView.java
/** * ??tab.// ww w . j a v a 2 s . c o m * * @param tabText the tab text * @param fragment the fragment */ public void addItemView(String tabText, Fragment fragment) { tabItemTextList.add(tabText); pagerItemList.add(fragment); tabItemList.clear(); mTabLayout.removeAllViews(); for (int i = 0; i < tabItemTextList.size(); i++) { final int index = i; String text = tabItemTextList.get(i); TextView tv = new TextView(this.context); tv.setTextColor(tabColor); tv.setTextSize(tabTextSize); tv.setText(text); tv.setGravity(Gravity.CENTER); tv.setLayoutParams(new LayoutParams(0, LayoutParams.FILL_PARENT, 1)); tv.setPadding(12, 5, 12, 5); tv.setFocusable(false); tabItemList.add(tv); mTabLayout.addView(tv); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mViewPager.setCurrentItem(index); } }); } //? ESLogUtil.d(ESSlidingSmoothFixTabView.class, "addItemView finish"); mFragmentPagerAdapter.notifyDataSetChanged(); mViewPager.setCurrentItem(0); computeTabImg(0); }
From source file:biz.incomsystems.fwknop2.ConfigDetailFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // This handles the qrcode results if (requestCode == 0) { if (resultCode == Activity.RESULT_OK) { String contents = data.getStringExtra("SCAN_RESULT"); for (String stanzas : contents.split(" ")) { String[] tmp = stanzas.split(":"); if (tmp[0].equalsIgnoreCase("KEY_BASE64")) { txt_KEY.setText(tmp[1]); chkb64key.setChecked(true); } else if (tmp[0].equalsIgnoreCase("KEY")) { txt_KEY.setText(tmp[1]); chkb64key.setChecked(false); } else if (tmp[0].equalsIgnoreCase("HMAC_KEY_BASE64")) { txt_HMAC.setText(tmp[1]); chkb64hmac.setChecked(true); } else if (tmp[0].equalsIgnoreCase("HMAC_KEY")) { txt_HMAC.setText(tmp[1]); chkb64hmac.setChecked(false); }//from w ww . j a v a 2 s . c o m } // end for loop } if (resultCode == Activity.RESULT_CANCELED) { //handle cancel Context context = getActivity(); CharSequence text = " QR Code Canceled"; int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, text, duration); toast.setGravity(Gravity.CENTER, 0, 0); LinearLayout toastLayout = (LinearLayout) toast.getView(); TextView toastTV = (TextView) toastLayout.getChildAt(0); toastTV.setTextSize(30); toast.show(); } } }
From source file:com.uzmap.pkg.uzmodules.uzBMap.mode.Billboard.java
private TextView title() { TextView title = new TextView(context); title.setSingleLine();/*from w ww. ja v a2 s. co m*/ title.setEllipsize(TruncateAt.END); title.setMaxWidth(UZCoreUtil.dipToPix(maxWidth) - 2 * iconMarginLeft + iconSize); title.setText(getTitle()); title.setTextColor(getTitleColor()); title.setTextSize(getTitleSize()); title.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL); return title; }