List of usage examples for android.widget TextView setPadding
@Override public void setPadding(int left, int top, int right, int bottom)
From source file:cc.softwarefactory.lokki.android.fragments.HelpFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { TextView textView = new TextView(getActivity()); textView.setPadding(15, 15, 15, 15); textView.setMovementMethod(LinkMovementMethod.getInstance()); ScrollView scroller = new ScrollView(getActivity()); scroller.addView(textView);/* ww w . j a v a 2 s . c o m*/ return scroller; }
From source file:nf.frex.android.FrexActivity.java
public static void showYesNoDialog(Context context, int titleId, String message, DialogInterface.OnClickListener yesListener, DialogInterface.OnClickListener noListener, DialogInterface.OnCancelListener cancelListener) { TextView textView = new TextView(context); textView.setSingleLine(false);/*from www . j a v a 2 s . c o m*/ textView.setPadding(10, 10, 10, 10); textView.setText(message); AlertDialog.Builder b = new AlertDialog.Builder(context); b.setTitle(titleId); b.setView(textView); b.setCancelable(true); if (yesListener != null) { b.setPositiveButton(android.R.string.yes, yesListener); } if (noListener != null) { b.setNegativeButton(android.R.string.no, noListener); } if (cancelListener != null) { b.setOnCancelListener(cancelListener); } b.show(); }
From source file:com.slushpupie.deskclock.ChangelogDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Standard AlertDialog does not support HTML-style links. // So rebuild the ScrollView->TextView with the appropriate // settings and set the view directly. TextView tv = new TextView(getActivity()); tv.setPadding(5, 5, 5, 5); tv.setLinksClickable(true);/* ww w .j av a2 s . c om*/ tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setText(R.string.changeLog); tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium); ScrollView sv = new ScrollView(getActivity()); sv.setPadding(14, 2, 10, 12); sv.addView(tv); builder.setView(sv).setCancelable(false).setTitle(R.string.changeLogTitle).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ((DeskClock) getActivity()).acknoledgeChangelog(); } }); return builder.create(); }
From source file:com.jeffreyawest.weblogic.monitor.charting.DefaultPieChart.java
protected final TableRow getRow(final Activity pActivity, int pColor, String pValue) { TableRow row = new TableRow(pActivity); row.setPadding(2, 2, 2, 2);/*ww w. jav a 2 s. com*/ pActivity.getResources().getDimension(R.dimen.graph_fragment_legend_graphic_size); TextView colorView = new TextView(pActivity); colorView.setBackgroundColor(pColor); colorView .setHeight((int) pActivity.getResources().getDimension(R.dimen.graph_fragment_legend_graphic_size)); colorView.setText(" "); colorView.setWidth((int) pActivity.getResources().getDimension(R.dimen.graph_fragment_legend_graphic_size)); row.addView(colorView); TextView text = new TextView(pActivity); text.setText(pValue); text.setPadding(2, 2, 2, 2); text.setTextSize(15); row.addView(text); return row; }
From source file:at.wada811.android.dialogfragments.sample.dialogfragmentcallbackprovider.DialogFragmentCallbackProviderFragment.java
@Override public DialogFragmentCallback getDialogFragmentCallback() { return new SimpleDialogFragmentCallback() { @Override/* w w w. j ava2 s .co m*/ public View getView(DialogFragmentInterface dialog) { TextView titleView = new TextView(getActivity()); titleView.setText("Use getChildFragmentManager()"); titleView.setPadding(0, 24, 0, 24); titleView.setGravity(Gravity.CENTER); titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); return titleView; } }; }
From source file:com.coincide.alphafitness.ui.Activity_Main.java
public boolean optionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: getFragmentManager().popBackStackImmediate(); break;// www .j a v a 2s .c om case R.id.action_settings: getFragmentManager().beginTransaction().replace(android.R.id.content, new Fragment_Settings()) .addToBackStack(null).commit(); break; case R.id.action_leaderboard: case R.id.action_achievements: AlertDialog.Builder builder2 = new AlertDialog.Builder(this); builder2.setTitle("Google services required"); builder2.setMessage("This feature is not available on the F-Droid version of the app"); builder2.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder2.create().show(); break; case R.id.action_faq: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://j4velin.de/faq/index.php?app=pm")) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); break; case R.id.action_about: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.about); TextView tv = new TextView(this); tv.setPadding(10, 10, 10, 10); tv.setText(R.string.about_text_links); try { tv.append(getString(R.string.about_app_version, getPackageManager().getPackageInfo(getPackageName(), 0).versionName)); } catch (NameNotFoundException e1) { // should not happen as the app is definitely installed when // seeing the dialog e1.printStackTrace(); } tv.setMovementMethod(LinkMovementMethod.getInstance()); builder.setView(tv); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); break; } return true; }
From source file:com.pedometrak.ui.ActivityMain.java
public boolean handleItemSelected(final MenuItem item) { switch (item.getItemId()) { case android.R.id.home: getFragmentManager().popBackStackImmediate(); break;/*from www. ja v a 2s .co m*/ case R.id.action_settings: getFragmentManager().beginTransaction().replace(android.R.id.content, new FragmentSettings()) .addToBackStack(null).commit(); break; case R.id.action_about: AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.about); TextView tv = new TextView(this); tv.setPadding(30, 30, 30, 30); tv.setText(R.string.about_text_links); try { tv.append(getString(R.string.about_app_version, getPackageManager().getPackageInfo(getPackageName(), 0).versionName)); } catch (NameNotFoundException e1) { // should not happen as the app is definitely installed when // seeing the dialog e1.printStackTrace(); } tv.setMovementMethod(LinkMovementMethod.getInstance()); builder.setView(tv); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); break; } return true; }
From source file:com.madgag.agit.RepoListFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setEmptyText(clickableWelcomeMessage()); TextView emptyView = textViewForEmptyListText(); makeLinksClickableIn(emptyView);// w w w . j a v a 2 s . c o m emptyView.setPadding(20, 20, 20, 20); // TODO Care about dip ratio for padding }
From source file:com.amazonaws.demo.messageboard.MessageQueueAdapter.java
public View getView(int pos, View convertView, ViewGroup parent) { TextView messageText = new TextView(parent.getContext()); messageText.setText(this.getMessageText(pos)); messageText.setGravity(Gravity.LEFT); messageText.setPadding(10, 10, 10, 10); messageText.setMaxWidth(200);// ww w.j a v a 2 s . c om messageText.setMinWidth(200); messageText.setTextSize(16); return messageText; }
From source file:com.softminds.matrixcalculator.ChangeLogActivity.java
private void SetNewContents(int key) { if (!Changes(key).equals("null")) { CardView.LayoutParams param = new CardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); CardView card = new CardView(this); if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("DARK_THEME_KEY", false)) card.setCardBackgroundColor(ContextCompat.getColor(this, R.color.DarkcolorPrimary)); card.setCardElevation(5);//from w ww . ja v a 2s . c o m card.setLayoutParams(param); card.setPadding(ConvertTopx(15), ConvertTopx(15), ConvertTopx(15), ConvertTopx(15)); card.setUseCompatPadding(true); TextView changes = new TextView(this); changes.setGravity(Gravity.CENTER); changes.setPadding(ConvertTopx(5), ConvertTopx(5), ConvertTopx(5), ConvertTopx(5)); changes.setText(Changes(key)); changes.setTypeface(Typeface.MONOSPACE); if (firebaseRemoteConfig.getBoolean("mark_red") && key == 0) changes.setTextColor(Color.RED); card.addView(changes); layout.addView(card); } bar.setVisibility(View.GONE); }