List of usage examples for android.widget TextView setPadding
@Override public void setPadding(int left, int top, int right, int bottom)
From source file:com.oldfeel.view.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//from w w w . ja v a 2 s. c om */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); textView.setAllCaps(true); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); int count = mViewPager.getAdapter().getCount(); if (count > 0 && count <= 4) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); textView.setWidth(size.x / count); } return textView; }
From source file:com.yktx.check.widget.OldPagerSlidingTabStrip.java
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title);/*from w w w .j a va2 s .co m*/ tab.setSingleLine(); tab.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); tab.setGravity(Gravity.CENTER); tab.setPadding(0, 3, 0, 0); addTab(position, tab); }
From source file:org.quantumbadger.redreader.activities.InboxListingActivity.java
private void makeFirstRequest(final Context context) { final RedditAccount user = RedditAccountManager.getInstance(context).getDefaultAccount(); final CacheManager cm = CacheManager.getInstance(context); final URI url; if (!isModmail) { url = Constants.Reddit.getUri("/message/inbox.json?mark=true&limit=100"); } else {/* ww w . j av a2 s . c om*/ url = Constants.Reddit.getUri("/message/moderator.json?limit=100"); } // TODO parameterise limit request = new CacheRequest(url, user, null, Constants.Priority.API_INBOX_LIST, 0, CacheRequest.DownloadType.FORCE, Constants.FileType.INBOX_LIST, true, true, true, context) { @Override protected void onDownloadNecessary() { } @Override protected void onDownloadStarted() { } @Override protected void onCallbackException(final Throwable t) { request = null; BugReportActivity.handleGlobalError(context, t); } @Override protected void onFailure(final RequestFailureType type, final Throwable t, final StatusLine status, final String readableMessage) { request = null; if (loadingView != null) loadingView.setDone(R.string.download_failed); final RRError error = General.getGeneralErrorForFailure(context, type, t, status, url.toString()); AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { notifications.addView(new ErrorView(InboxListingActivity.this, error)); } }); if (t != null) t.printStackTrace(); } @Override protected void onProgress(final boolean authorizationInProgress, final long bytesRead, final long totalBytes) { } @Override protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, final long timestamp, final UUID session, final boolean fromCache, final String mimetype) { request = null; } @Override public void onJsonParseStarted(final JsonValue value, final long timestamp, final UUID session, final boolean fromCache) { if (loadingView != null) loadingView.setIndeterminate(R.string.download_downloading); // TODO pref (currently 10 mins) // TODO xml if (fromCache && RRTime.since(timestamp) > 10 * 60 * 1000) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { final TextView cacheNotif = new TextView(context); cacheNotif.setText(context.getString(R.string.listing_cached) + RRTime.formatDateTime(timestamp, context)); final int paddingPx = General.dpToPixels(context, 6); final int sidePaddingPx = General.dpToPixels(context, 10); cacheNotif.setPadding(sidePaddingPx, paddingPx, sidePaddingPx, paddingPx); cacheNotif.setTextSize(13f); notifications.addView(cacheNotif); adapter.notifyDataSetChanged(); } }); } // TODO {"error": 403} is received for unauthorized subreddits try { final JsonBufferedObject root = value.asObject(); final JsonBufferedObject data = root.getObject("data"); final JsonBufferedArray children = data.getArray("children"); for (JsonValue child : children) { final RedditThing thing = child.asObject(RedditThing.class); switch (thing.getKind()) { case COMMENT: final RedditPreparedComment comment = new RedditPreparedComment( InboxListingActivity.this, thing.asComment(), timestamp, false, null, user, headerItems); itemHandler.sendMessage(General.handlerMessage(0, comment)); break; case MESSAGE: final RedditPreparedMessage message = new RedditPreparedMessage( InboxListingActivity.this, thing.asMessage(), timestamp); itemHandler.sendMessage(General.handlerMessage(0, message)); if (message.src.replies != null && message.src.replies.getType() == JsonValue.Type.OBJECT) { final JsonBufferedArray replies = message.src.replies.asObject().getObject("data") .getArray("children"); for (JsonValue childMsgValue : replies) { final RedditMessage childMsgRaw = childMsgValue.asObject(RedditThing.class) .asMessage(); final RedditPreparedMessage childMsg = new RedditPreparedMessage( InboxListingActivity.this, childMsgRaw, timestamp); itemHandler.sendMessage(General.handlerMessage(0, childMsg)); } } break; default: throw new RuntimeException("Unknown item in list."); } } } catch (Throwable t) { notifyFailure(RequestFailureType.PARSE, t, null, "Parse failure"); return; } if (loadingView != null) loadingView.setDone(R.string.download_done); } }; cm.makeRequest(request); }
From source file:com.TakeTaxi.jy.OnrouteScreen.java
public void pingpicked(JSONObject json) { try {//from www.ja v a 2 s . c o m int driverpicked = json.getInt("picked"); int drivercancelled = json.getInt("dcancel"); int starttime = json.getInt("datetime"); // /////////////////////////////// DRIVER CANCEL //////// if (drivercancelled == 1) { // //// DRIVER CANCEL LATE ///// if (starttime + 300 <= Query.getServerTime()) { handlerboolean = false; handler.removeCallbacks(r); AlertDialog dcancelbuilder = new AlertDialog.Builder(OnrouteScreen.this).create(); dcancelbuilder .setMessage("Job has been cancelled.\nWould you like to report a late cancellation?."); // //// DRIVER CANCEL LATE - NO REPORT LATE///// button_cancelJob_noquery(dcancelbuilder); // //// DRIVER CANCEL LATE - REPORT LATE ///// button_drivercancel_reportlate(dcancelbuilder); dcancelbuilder.show(); } else { // /////////////////////////////// DRIVER CANCEL NO ALERTS - // WITHIN TIME LIMIT/////////////// handlerboolean = false; handler.removeCallbacks(r); alertdialog_drivercancelintime(); } } if (driverpicked == 1) { // /////////////////////////////// CONFIRM PICK UP // /////////////////////////////////////////// handlerboolean = false; handler.removeCallbacks(r); AlertDialog.Builder alert = new AlertDialog.Builder(OnrouteScreen.this); final Drawable thumbsup = getResources().getDrawable(R.drawable.thumbsup); final Drawable thumbsupwhite = getResources().getDrawable(R.drawable.thumbsupwhite); final Drawable thumbsdown = getResources().getDrawable(R.drawable.thumbsdown); final Drawable thumbsdownwhite = getResources().getDrawable(R.drawable.thumbsdownwhite); LinearLayout layout = new LinearLayout(OnrouteScreen.this); layout.setOrientation(1); layout.setGravity(17); TextView tx1 = new TextView(OnrouteScreen.this); tx1.setText("Driver says you have been picked up"); tx1.setGravity(17); tx1.setTextSize(20); tx1.setTextColor(Color.WHITE); tx1.setPadding(10, 10, 10, 10); TextView tx2 = new TextView(OnrouteScreen.this); tx2.setText("Please rate your driver"); tx2.setGravity(17); tx2.setTextSize(16); LinearLayout imglayout = new LinearLayout(OnrouteScreen.this); imglayout.setOrientation(0); imglayout.setGravity(17); final ImageView ivup = new ImageView(OnrouteScreen.this); ivup.setImageDrawable(thumbsupwhite); ivup.setClickable(true); ivup.setPadding(0, 5, 30, 5); final ImageView ivdown = new ImageView(OnrouteScreen.this); ivdown.setImageDrawable(thumbsdownwhite); ivdown.setClickable(true); ivup.setPadding(30, 5, 0, 5); imglayout.addView(ivup); imglayout.addView(ivdown); layout.addView(tx1); layout.addView(tx2); layout.addView(imglayout); // /////////////////////////////// CONFIRM PICK UP - RATINGS // /////////////////////////////////////////// ivup.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (thumbsupboolean == false) { thumbsupboolean = true; thumbsdownboolean = false; ivup.setImageDrawable(thumbsup); ivdown.setImageDrawable(thumbsdownwhite); rating = 1; } else { thumbsupboolean = false; ivup.setImageDrawable(thumbsupwhite); rating = 0; } } }); ivdown.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (thumbsdownboolean == false) { thumbsdownboolean = true; thumbsupboolean = false; ivdown.setImageDrawable(thumbsdown); ivup.setImageDrawable(thumbsupwhite); AlertDialog alert = new AlertDialog.Builder(OnrouteScreen.this).create(); alert.setMessage("Please pick one"); alert.setButton("No show", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { rating = -1; } }); alert.setButton2("Driver late", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { rating = -2; } }); alert.setButton3("Poor service", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { rating = -3; } }); alert.show(); } else { thumbsupboolean = false; ivdown.setImageDrawable(thumbsdownwhite); rating = 0; } } }); button_completed_finish(alert); alert.setView(layout); alert.create(); alert.show(); } else { } } catch (JSONException e) { } }
From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java
public void hideNoInternetScreen() { hideLoadingScreen();//from ww w. ja va2 s.c o m TextView ConnectionTV = (TextView) findViewById(R.id.loading_tv); ConnectionTV.setText("Loading smog data"); ConnectionTV.setTextColor(Color.parseColor("#FF00BEED")); ConnectionTV.setPadding(0, 30, 0, 30); }
From source file:com.sdei.slidingtabs.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//from ww w . j av a2s . c o m */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextColor(Color.WHITE); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:com.timothy.android.api.fragment.PageFragmentNew.java
public void setAllComponent(List<HtmlCleanAPI.HtmlContent> hcList) { Log.i(LOG_TAG, "setAllComponent()..."); for (HtmlCleanAPI.HtmlContent hc : hcList) { String tag = hc.getTag(); String content = hc.getContent(); if (StringUtil.isEmpty(content)) continue; String contentMBlank = StringUtil.mergeBlank(content); if (StringUtil.isEmpty(contentMBlank)) continue; String contentRBlank = StringUtil.rmvEnter(StringUtil.trim(contentMBlank)); if (StringUtil.isEmpty(contentRBlank)) continue; String contentRSpecial = StringUtil.rmvSpecial(contentRBlank); if (StringUtil.isEmpty(contentRSpecial)) continue; Log.i(LOG_TAG, "tag:" + tag); Log.i(LOG_TAG, "content:" + contentRSpecial); if (tag.equalsIgnoreCase("P")) { final TextView tagPTV = new TextView(mContext); tagPTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 3, 2, 3);//from w w w . j a va 2 s. com tagPTV.setLayoutParams(lp); tagPTV.setPadding(3, 3, 3, 3); tagPTV.setPaddingRelative(3, 3, 3, 3); tagPTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPTV.setTextColor(Color.BLACK); tagPTV.setText(contentRSpecial); tagPTV.setTextSize(TEXT_SIZE); tagPTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPTV.getText().toString()); return false; } }); lineLayout.addView(tagPTV); } else if (tag.equalsIgnoreCase("pre")) { final TextView tagPre = new TextView(mContext); tagPre.setBackgroundColor(Color.parseColor("#D2EADE")); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagPre.setLayoutParams(lp); tagPre.setPadding(2, 2, 2, 2); tagPre.setPaddingRelative(2, 2, 2, 2); tagPre.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPre.setTextColor(Color.BLACK); // String contentRSpecial = StringUtil.rmvSpecial(content); tagPre.setText(StringUtil.rmvSpecial(content)); tagPre.setTextSize(TEXT_SIZE); tagPre.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPre.getText().toString()); return false; } }); lineLayout.addView(tagPre); } else if (tag.equalsIgnoreCase("dt") || tag.equalsIgnoreCase("H1") || tag.equalsIgnoreCase("H2") || tag.equalsIgnoreCase("H3")) {//title TextView tagDtHTV = new TextView(mContext); tagDtHTV.setBackgroundColor(Color.DKGRAY); tagDtHTV.setTypeface(null, Typeface.BOLD); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 0, 2, 0); tagDtHTV.setLayoutParams(lp); tagDtHTV.setPadding(2, 2, 2, 2); tagDtHTV.setPaddingRelative(2, 2, 2, 2); tagDtHTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDtHTV.setTextColor(Color.WHITE); tagDtHTV.setText(contentRSpecial); tagDtHTV.setTextSize(TEXT_SIZE); lineLayout.addView(tagDtHTV); } else if (tag.equalsIgnoreCase("dd")) { final TextView tagDD = new TextView(mContext); tagDD.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagDD.setLayoutParams(lp); tagDD.setPadding(3, 3, 3, 3); tagDD.setPaddingRelative(3, 3, 3, 3); tagDD.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDD.setTextColor(Color.BLACK); tagDD.setText(contentRSpecial); tagDD.setTextSize(TEXT_SIZE); tagDD.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagDD.getText().toString()); return false; } }); lineLayout.addView(tagDD); } else if (tag.equalsIgnoreCase("li")) { final TextView tagLigTV = new TextView(mContext); tagLigTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagLigTV.setLayoutParams(lp); tagLigTV.setPaddingRelative(2, 2, 2, 2); tagLigTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagLigTV.setTextColor(Color.BLACK); tagLigTV.setText(contentRSpecial); tagLigTV.setTextSize(TEXT_SIZE); tagLigTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagLigTV.getText().toString()); return false; } }); lineLayout.addView(tagLigTV); } else if (tag.equalsIgnoreCase("img")) { final TextView imgTV = new TextView(mContext); imgTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); imgTV.setLayoutParams(lp); imgTV.setPaddingRelative(2, 2, 2, 2); imgTV.setMovementMethod(ScrollingMovementMethod.getInstance()); imgTV.setTextColor(Color.BLACK); imgTV.setText(content); imgTV.setTextSize(TEXT_SIZE); lineLayout.addView(imgTV); ImageView imageView = new ImageView(mContext); LinearLayout.LayoutParams imgLP = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); imageView.setLayoutParams(imgLP); Bitmap localBt = getLoacalBitmap(baseFolder + File.separator + content); imageView.setImageBitmap(localBt); lineLayout.addView(imageView); } } }
From source file:com.timothy.android.api.fragment.PageFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContext = getActivity().getApplicationContext(); //get activity and SharedPreferences activity = (SlidingActivity) getActivity(); sp = activity.getSharedPreferences("AndroidAPISP", 0); mContext = activity.getApplicationContext(); View mView = inflater.inflate(R.layout.view_pager_text, null); lineLayout = (LinearLayout) mView.findViewById(R.id.lineLayout); // ContentBean bean = XMLParserUtil.getContentByIndex(mContext, getIndex()); // ContentBean mBean = XMLParserUtil.getContentByIndex(mContext, bean.getmIndex()); // String[] contentsArray = getResources().getStringArray(R.array.contents_array); int branchIndex = SPUtil.getIntegerFromSP(SPUtil.CURRENT_BRANCH_INDEX, sp); String[] contentsArray = activity.filterBranch(branchIndex); String contents = ContentUtil.getContentsById(contentsArray, SPUtil.getIntegerFromSP(SPUtil.CURRENT_INDEX, sp)); String[] contentArray = contents.split(","); String contentName = contentArray[3]; // String superContents = ContentUtil.getSuperContentsById(contentsArray, SPUtil.getIntegerFromSP(SPUtil.CURRENT_INDEX, sp)); // String[] supercontentArray = superContents.split(","); // String superContentName = supercontentArray[3]; // String name = null; String pageNo = null;/* w w w . jav a2s . c o m*/ if (getIndex() > 0 && getPageIndex() > 0) { // name = contentName; pageNo = String.valueOf(getPageIndex()); String appPath = SPUtil.getFromSP(SPUtil.APP_HOME_PATH, sp); String branchName = SPUtil.getFromSP(SPUtil.BRANCH_PATH_NAME, sp); baseFolder = appPath + File.separator + branchName; // String xmlurl = baseFolder + StringUtil.rmvSpace(superContentName) + File.separator + StringUtil.rmvSpace(contentName) + ".xml"; String xmlurl = baseFolder + File.separator + StringUtil.rmvSpace(contentName) + ".xml"; Log.i(LOG_TAG, "xmlurl:" + xmlurl); Log.i(LOG_TAG, "pageNo:" + pageNo); if (new File(xmlurl).exists()) { new GetData().execute(new String[] { xmlurl, pageNo }); } else { Toast.makeText(mContext, "No Content!", Toast.LENGTH_SHORT).show(); } } else { TextView failTV = new TextView(mContext); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); // lp.gravity = Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL; lp.gravity = Gravity.CENTER; lp.setMargins(2, 2, 2, 2); failTV.setLayoutParams(lp); // failTV.setMovementMethod(ScrollingMovementMethod.getInstance()) ; failTV.setPadding(3, 3, 3, 3); int errorCode = getErrorCode(); switch (errorCode) { case 1: failTV.setText(ERROR_MESSGE_ONE); break; case 2: failTV.setText(ERROR_MESSGE_TWO); break; case 3: failTV.setText(ERROR_MESSGE_THREE + ":" + contentArray[4]); break; case 4: failTV.setText(ERROR_MESSGE_FOUR + ":" + contentArray[4]); break;//?? default: failTV.setText(ERROR_MESSGE_DEFAULT); break; } failTV.setTextColor(Color.RED); failTV.setTextSize(18.0f); lineLayout.addView(failTV); } //Save current page SPUtil.save2SP(SPUtil.SP_KEY_PAGE_INDEX, getPageIndex(), sp); SPUtil.save2SP(SPUtil.SP_KEY_READ_TIME, TimeUtil.getNowTimeStr(), sp); return mView; }
From source file:com.sonvp.tooltip.Tooltip.java
private View getViewTooltip(Builder builder, int backgroundColor) { View toolTip = null;//from w w w. j a v a 2s . c o m if (builder.viewTooltip == null) { TextView text = new TextView(builder.context); text.setPadding((int) builder.leftPadding, (int) builder.topPadding, (int) builder.rightPadding, (int) builder.bottomPadding); text.setGravity(builder.textGravity); text.setTextColor(builder.textColor); text.setTextSize(TypedValue.COMPLEX_UNIT_PX, builder.textSize); text.setTypeface(builder.typeface, builder.typefaceStyle); int lines = builder.lines; if (lines > 0) { text.setLines(lines); text.setEllipsize(TextUtils.TruncateAt.END); } CharSequence txt = builder.text; if (TextUtils.isEmpty(txt)) { txt = builder.context.getString(builder.textResourceId); } text.setText(txt); toolTip = text; } else { toolTip = builder.viewTooltip; } float radius = builder.radius; if (radius > 0.0F) { GradientDrawable drawable = new GradientDrawable(); drawable.setColor(backgroundColor); drawable.setGradientType(GradientDrawable.LINEAR_GRADIENT); drawable.setCornerRadius(radius); //noinspection deprecation toolTip.setBackgroundDrawable(drawable); } else { toolTip.setBackgroundColor(backgroundColor); } return toolTip; }
From source file:com.thenewboston.SlidingTabLayout.java
protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); textView.setTypeface(Typeface.DEFAULT_BOLD); textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); TypedValue outValue = new TypedValue(); getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true); textView.setBackgroundResource(outValue.resourceId); int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }