android.widget.TextView

Here are the examples of the java api class android.widget.TextView taken from open source projects.

1. DeviceDetailsActivity#appendIBeaconInfo()

View license
private void appendIBeaconInfo(final MergeAdapter adapter, final IBeaconManufacturerData iBeaconData) {
    final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_ibeacon_details, null);
    final TextView tvCompanyId = (TextView) lt.findViewById(R.id.companyId);
    final TextView tvAdvert = (TextView) lt.findViewById(R.id.advertisement);
    final TextView tvUUID = (TextView) lt.findViewById(R.id.uuid);
    final TextView tvMajor = (TextView) lt.findViewById(R.id.major);
    final TextView tvMinor = (TextView) lt.findViewById(R.id.minor);
    final TextView tvTxPower = (TextView) lt.findViewById(R.id.txpower);
    tvCompanyId.setText(CompanyIdentifierResolver.getCompanyName(iBeaconData.getCompanyIdentifier(), getString(R.string.unknown)) + " (" + hexEncode(iBeaconData.getCompanyIdentifier()) + ")");
    tvAdvert.setText(iBeaconData.getIBeaconAdvertisement() + " (" + hexEncode(iBeaconData.getIBeaconAdvertisement()) + ")");
    tvUUID.setText(iBeaconData.getUUID());
    tvMajor.setText(iBeaconData.getMajor() + " (" + hexEncode(iBeaconData.getMajor()) + ")");
    tvMinor.setText(iBeaconData.getMinor() + " (" + hexEncode(iBeaconData.getMinor()) + ")");
    tvTxPower.setText(iBeaconData.getCalibratedTxPower() + " (" + hexEncode(iBeaconData.getCalibratedTxPower()) + ")");
    adapter.addView(lt);
}

2. AboutFragment#onViewCreated()

Project: FaceSlim
Source File: AboutFragment.java
View license
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    // fill several TextView elements with strings
    String versionName = BuildConfig.VERSION_NAME;
    String authorInfo = getString(R.string.app_name) + " " + getString(R.string.author);
    //noinspection ConstantConditions
    TextView textAuthor = (TextView) getView().findViewById(R.id.textAuthor);
    TextView textSpecialThanksLink = (TextView) getView().findViewById(R.id.textSpecialThanksLink);
    TextView textGithub = (TextView) getView().findViewById(R.id.textGithub);
    TextView textFdroid = (TextView) getView().findViewById(R.id.textFdroid);
    TextView textIndywidualni = (TextView) getView().findViewById(R.id.textIndywidualni);
    TextView textVersion = (TextView) getView().findViewById(R.id.textVersion);
    textAuthor.setText(authorInfo);
    textSpecialThanksLink.setMovementMethod(LinkMovementMethod.getInstance());
    textGithub.setMovementMethod(LinkMovementMethod.getInstance());
    textFdroid.setMovementMethod(LinkMovementMethod.getInstance());
    textIndywidualni.setMovementMethod(LinkMovementMethod.getInstance());
    textVersion.setText(versionName);
}

3. DeviceDetailsActivity#appendRssiInfo()

View license
private void appendRssiInfo(final MergeAdapter adapter, final BluetoothLeDevice device) {
    final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_rssi_info, null);
    final TextView tvFirstTimestamp = (TextView) lt.findViewById(R.id.firstTimestamp);
    final TextView tvFirstRssi = (TextView) lt.findViewById(R.id.firstRssi);
    final TextView tvLastTimestamp = (TextView) lt.findViewById(R.id.lastTimestamp);
    final TextView tvLastRssi = (TextView) lt.findViewById(R.id.lastRssi);
    final TextView tvRunningAverageRssi = (TextView) lt.findViewById(R.id.runningAverageRssi);
    tvFirstTimestamp.setText(formatTime(device.getFirstTimestamp()));
    tvFirstRssi.setText(formatRssi(device.getFirstRssi()));
    tvLastTimestamp.setText(formatTime(device.getTimestamp()));
    tvLastRssi.setText(formatRssi(device.getRssi()));
    tvRunningAverageRssi.setText(formatRssi(device.getRunningAverageRssi()));
    adapter.addView(lt);
}

4. ContactDetailsActivity#showCertificateInformationDialog()

View license
private void showCertificateInformationDialog(Bundle bundle) {
    View view = getLayoutInflater().inflate(R.layout.certificate_information, null);
    final String not_available = getString(R.string.certicate_info_not_available);
    TextView subject_cn = (TextView) view.findViewById(R.id.subject_cn);
    TextView subject_o = (TextView) view.findViewById(R.id.subject_o);
    TextView issuer_cn = (TextView) view.findViewById(R.id.issuer_cn);
    TextView issuer_o = (TextView) view.findViewById(R.id.issuer_o);
    TextView sha1 = (TextView) view.findViewById(R.id.sha1);
    subject_cn.setText(bundle.getString("subject_cn", not_available));
    subject_o.setText(bundle.getString("subject_o", not_available));
    issuer_cn.setText(bundle.getString("issuer_cn", not_available));
    issuer_o.setText(bundle.getString("issuer_o", not_available));
    sha1.setText(bundle.getString("sha1", not_available));
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.certificate_information);
    builder.setView(view);
    builder.setPositiveButton(R.string.ok, null);
    builder.create().show();
}

5. SizeAdapter#getView()

View license
public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;
    if (convertView == null)
        vi = inflater.inflate(R.layout.size_list_row, parent, false);
    final Size size = data.get(position);
    TextView ramcpuTextView = (TextView) vi.findViewById(R.id.ramcpuTextView);
    TextView diskTextView = (TextView) vi.findViewById(R.id.diskTextView);
    TextView transferTextView = (TextView) vi.findViewById(R.id.transferTextView);
    TextView monthlyPriceTextView = (TextView) vi.findViewById(R.id.monthlyPriceTextView);
    TextView hourlyPriceTextView = (TextView) vi.findViewById(R.id.hourlyPriceTextView);
    ramcpuTextView.setText(size.getSlug().toUpperCase(Locale.US) + "/" + size.getCpu() + "CPU");
    diskTextView.setText(size.getDisk() + "GB SSD DISK");
    transferTextView.setText(size.getTransfer() + "TB TRANSFER");
    Formatter formatter = new Formatter();
    monthlyPriceTextView.setText("$" + size.getCostPerMonth() + "/mo");
    hourlyPriceTextView.setText("$" + formatter.format("%1.5f", size.getCostPerHour()) + "/hour");
    formatter.close();
    return vi;
}

6. AdapterDns#bindView()

Project: NetGuard
Source File: AdapterDns.java
View license
@Override
public void bindView(final View view, final Context context, final Cursor cursor) {
    // Get values
    long time = cursor.getLong(colTime);
    String qname = cursor.getString(colQName);
    String aname = cursor.getString(colAName);
    String resource = cursor.getString(colResource);
    int ttl = cursor.getInt(colTTL);
    // Get views
    TextView tvTime = (TextView) view.findViewById(R.id.tvTime);
    TextView tvQName = (TextView) view.findViewById(R.id.tvQName);
    TextView tvAName = (TextView) view.findViewById(R.id.tvAName);
    TextView tvResource = (TextView) view.findViewById(R.id.tvResource);
    TextView tvTTL = (TextView) view.findViewById(R.id.tvTTL);
    // Set values
    tvTime.setText(new SimpleDateFormat("dd HH:mm").format(time));
    tvQName.setText(qname);
    tvAName.setText(aname);
    tvResource.setText(resource);
    tvTTL.setText(Integer.toString(ttl));
}

7. AdapterForwarding#bindView()

Project: NetGuard
Source File: AdapterForwarding.java
View license
@Override
public void bindView(final View view, final Context context, final Cursor cursor) {
    // Get values
    int protocol = cursor.getInt(colProtocol);
    int dport = cursor.getInt(colDPort);
    String raddr = cursor.getString(colRAddr);
    int rport = cursor.getInt(colRPort);
    int ruid = cursor.getInt(colRUid);
    // Get views
    TextView tvProtocol = (TextView) view.findViewById(R.id.tvProtocol);
    TextView tvDPort = (TextView) view.findViewById(R.id.tvDPort);
    TextView tvRAddr = (TextView) view.findViewById(R.id.tvRAddr);
    TextView tvRPort = (TextView) view.findViewById(R.id.tvRPort);
    TextView tvRUid = (TextView) view.findViewById(R.id.tvRUid);
    tvProtocol.setText(Util.getProtocolName(protocol, 0, false));
    tvDPort.setText(Integer.toString(dport));
    tvRAddr.setText(raddr);
    tvRPort.setText(Integer.toString(rport));
    tvRUid.setText(TextUtils.join(", ", Util.getApplicationNames(ruid, context)));
}

8. MicroBlogActivity#initComponent()

Project: YiBo
Source File: MicroBlogActivity.java
View license
public void initComponent() {
    LinearLayout llRoot = (LinearLayout) findViewById(R.id.llRoot);
    LinearLayout llHeaderBase = (LinearLayout) findViewById(R.id.llHeaderBase);
    ThemeUtil.setRootBackground(llRoot);
    ThemeUtil.setSecondaryMicroBlogHeader(llHeaderBase);
    //????
    LayoutInflater inflater = LayoutInflater.from(this);
    View headerView = inflater.inflate(R.layout.include_micro_blog_list_header, null);
    LinearLayout llProfileHeader = (LinearLayout) headerView.findViewById(R.id.llProfileHeader);
    TextView tvScreenName = (TextView) headerView.findViewById(R.id.tvScreenName);
    ImageView ivVerify = (ImageView) headerView.findViewById(R.id.ivVerify);
    TextView tvImpress = (TextView) headerView.findViewById(R.id.tvImpress);
    ImageView ivMoreDetail = (ImageView) headerView.findViewById(R.id.ivMoreDetail);
    ThemeUtil.setHeaderProfile(llProfileHeader);
    int highlight = theme.getColor("highlight");
    tvScreenName.setTextColor(highlight);
    ivVerify.setImageDrawable(theme.getDrawable("icon_verification"));
    tvImpress.setTextColor(theme.getColor("content"));
    ivMoreDetail.setBackgroundDrawable(theme.getDrawable("icon_more_detail"));
    //????
    TextView tvText = (TextView) headerView.findViewById(R.id.tvText);
    LinearLayout llThumbnailShape = (LinearLayout) headerView.findViewById(R.id.llThumbnailShape);
    TextView tvImageInfo = (TextView) headerView.findViewById(R.id.tvImageInfo);
    LinearLayout llRetweet = (LinearLayout) headerView.findViewById(R.id.llRetweet);
    TextView tvRetweetText = (TextView) headerView.findViewById(R.id.tvRetweetText);
    LinearLayout llRetweetThumbnailShape = (LinearLayout) headerView.findViewById(R.id.llRetweetThumbnailShape);
    TextView tvRetweetImageInfo = (TextView) headerView.findViewById(R.id.tvRetweetImageInfo);
    ImageView ivRetweetLocation = (ImageView) headerView.findViewById(R.id.ivRetweetLocation);
    TextView tvRetweetLocation = (TextView) headerView.findViewById(R.id.tvRetweetLocation);
    TextView tvRetweetCreatedAt = (TextView) headerView.findViewById(R.id.tvRetweetCreatedAt);
    TextView tvRetweetSource = (TextView) headerView.findViewById(R.id.tvRetweetSource);
    ImageView ivLocation = (ImageView) headerView.findViewById(R.id.ivLocation);
    TextView tvLocation = (TextView) headerView.findViewById(R.id.tvLocation);
    TextView tvCreatedAt = (TextView) headerView.findViewById(R.id.tvCreatedAt);
    TextView tvSource = (TextView) headerView.findViewById(R.id.tvSource);
    TextView tvRetweetCount = (TextView) headerView.findViewById(R.id.tvRetweetCount);
    TextView tvCommentCount = (TextView) headerView.findViewById(R.id.tvCommentCount);
    ImageView ivLineSeperator = (ImageView) headerView.findViewById(R.id.ivLineSeperator);
    tvText.setTextColor(theme.getColor("content"));
    ColorStateList selectorTextLink = theme.getColorStateList("selector_text_link");
    tvText.setLinkTextColor(selectorTextLink);
    Drawable shapeAttachment = theme.getDrawable("shape_attachment");
    llThumbnailShape.setBackgroundDrawable(shapeAttachment);
    int quote = theme.getColor("quote");
    tvImageInfo.setTextColor(quote);
    llRetweet.setBackgroundDrawable(theme.getDrawable("bg_retweet_frame"));
    int padding10 = theme.dip2px(10);
    llRetweet.setPadding(padding10, padding10, padding10, theme.dip2px(6));
    tvRetweetText.setTextColor(quote);
    tvRetweetText.setLinkTextColor(selectorTextLink);
    llRetweetThumbnailShape.setBackgroundDrawable(shapeAttachment);
    tvRetweetImageInfo.setTextColor(quote);
    Drawable iconLocation = theme.getDrawable("icon_location");
    ivRetweetLocation.setImageDrawable(iconLocation);
    tvRetweetLocation.setTextColor(quote);
    tvRetweetCreatedAt.setTextColor(quote);
    tvRetweetSource.setTextColor(quote);
    ivLocation.setImageDrawable(iconLocation);
    tvLocation.setTextColor(quote);
    tvCreatedAt.setTextColor(quote);
    tvSource.setTextColor(quote);
    int emphasize = theme.getColor("emphasize");
    tvRetweetCount.setTextColor(emphasize);
    tvCommentCount.setTextColor(emphasize);
    ivLineSeperator.setBackgroundDrawable(theme.getDrawable("line_comment_of_status_normal"));
    //???
    LinearLayout llToolbar = (LinearLayout) findViewById(R.id.llToolbar);
    Button btnComment = (Button) findViewById(R.id.btnComment);
    Button btnRetweet = (Button) findViewById(R.id.btnRetweet);
    Button btnFavorite = (Button) findViewById(R.id.btnFavorite);
    Button btnShare = (Button) findViewById(R.id.btnShare);
    Button btnMore = (Button) findViewById(R.id.btnMore);
    llToolbar.setBackgroundDrawable(theme.getDrawable("bg_toolbar"));
    btnComment.setBackgroundDrawable(theme.getDrawable("selector_toolbar_comment"));
    btnRetweet.setBackgroundDrawable(theme.getDrawable("selector_toolbar_retweet"));
    btnFavorite.setBackgroundDrawable(theme.getDrawable("selector_toolbar_favorite_add"));
    btnShare.setBackgroundDrawable(theme.getDrawable("selector_toolbar_share"));
    btnMore.setBackgroundDrawable(theme.getDrawable("selector_toolbar_more"));
    lvCommentsOfStatus = (ListView) this.findViewById(R.id.lvCommentsOfStatus);
    ThemeUtil.setListViewStyle(lvCommentsOfStatus);
    lvCommentsOfStatus.addHeaderView(headerView);
    setBack2Top(lvCommentsOfStatus);
    //???????
    View statusView = this.findViewById(R.id.llStatus);
    statusContextMenuListener = new MicroBlogStatusContextMenuListener(status);
    statusView.setOnCreateContextMenuListener(statusContextMenuListener);
    autoLoadMoreListener = new AutoLoadMoreListener();
}

9. SslCertificateViewAdapter#showSubject()

View license
private void showSubject(SslCertificate.DName subject, View dialogView) {
    TextView cnView = ((TextView) dialogView.findViewById(R.id.value_subject_CN));
    cnView.setText(subject.getCName());
    cnView.setVisibility(View.VISIBLE);
    TextView oView = ((TextView) dialogView.findViewById(R.id.value_subject_O));
    oView.setText(subject.getOName());
    oView.setVisibility(View.VISIBLE);
    TextView ouView = ((TextView) dialogView.findViewById(R.id.value_subject_OU));
    ouView.setText(subject.getUName());
    ouView.setVisibility(View.VISIBLE);
    // SslCertificates don't offer this information
    ((TextView) dialogView.findViewById(R.id.value_subject_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_subject_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_subject_L)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_subject_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_subject_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_subject_L)).setVisibility(View.GONE);
}

10. SslCertificateViewAdapter#showIssuer()

View license
private void showIssuer(SslCertificate.DName issuer, View dialogView) {
    TextView cnView = ((TextView) dialogView.findViewById(R.id.value_issuer_CN));
    cnView.setText(issuer.getCName());
    cnView.setVisibility(View.VISIBLE);
    TextView oView = ((TextView) dialogView.findViewById(R.id.value_issuer_O));
    oView.setText(issuer.getOName());
    oView.setVisibility(View.VISIBLE);
    TextView ouView = ((TextView) dialogView.findViewById(R.id.value_issuer_OU));
    ouView.setText(issuer.getUName());
    ouView.setVisibility(View.VISIBLE);
    // SslCertificates don't offer this information
    ((TextView) dialogView.findViewById(R.id.value_issuer_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_issuer_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_issuer_L)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_issuer_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_issuer_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_issuer_L)).setVisibility(View.GONE);
}

11. CustomViewGroup#setup()

Project: Android-Next
Source File: CustomViewGroup.java
View license
private void setup(Context context) {
    TextView tv = new TextView(context);
    tv.setBackgroundColor(Color.RED);
    tv.setText(" tv.setBackgroundColor(Color.RED);");
    addView(tv);
    for (int i = 0; i < 200; i++) {
        tv = new TextView(context);
        tv.setBackgroundColor(Color.RED);
        tv.setText(" Some Item " + i);
        addView(tv);
    }
    tv = new TextView(context);
    tv.setBackgroundColor(Color.GREEN);
    tv.setText(" 2015-08-27");
    addView(tv);
    tv = new TextView(context);
    tv.setBackgroundColor(Color.YELLOW);
    tv.setText(" 10 YELLOW");
    addView(tv);
}

12. EasySwitcher#getItemView()

View license
private View getItemView(int position) {
    TextView textView = new TextView(mContext);
    textView.setTextAppearance(mContext, R.style.switcher_item_text_style);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, DensityUtil.dip2px(mContext, 35));
    textView.setLayoutParams(layoutParams);
    textView.setSelected(position == mDefaultSelection);
    textView.setGravity(Gravity.CENTER);
    textView.setText(mAllItemArray.get(position));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12.0f);
    textView.setOnClickListener(mItemOnClickListener);
    textView.setTag(position);
    return textView;
}

13. SslCertificateViewAdapter#showSubject()

View license
private void showSubject(SslCertificate.DName subject, View dialogView) {
    TextView cnView = ((TextView) dialogView.findViewById(R.id.value_subject_CN));
    cnView.setText(subject.getCName());
    cnView.setVisibility(View.VISIBLE);
    TextView oView = ((TextView) dialogView.findViewById(R.id.value_subject_O));
    oView.setText(subject.getOName());
    oView.setVisibility(View.VISIBLE);
    TextView ouView = ((TextView) dialogView.findViewById(R.id.value_subject_OU));
    ouView.setText(subject.getUName());
    ouView.setVisibility(View.VISIBLE);
    // SslCertificates don't offer this information
    ((TextView) dialogView.findViewById(R.id.value_subject_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_subject_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_subject_L)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_subject_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_subject_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_subject_L)).setVisibility(View.GONE);
}

14. SslCertificateViewAdapter#showIssuer()

View license
private void showIssuer(SslCertificate.DName issuer, View dialogView) {
    TextView cnView = ((TextView) dialogView.findViewById(R.id.value_issuer_CN));
    cnView.setText(issuer.getCName());
    cnView.setVisibility(View.VISIBLE);
    TextView oView = ((TextView) dialogView.findViewById(R.id.value_issuer_O));
    oView.setText(issuer.getOName());
    oView.setVisibility(View.VISIBLE);
    TextView ouView = ((TextView) dialogView.findViewById(R.id.value_issuer_OU));
    ouView.setText(issuer.getUName());
    ouView.setVisibility(View.VISIBLE);
    // SslCertificates don't offer this information
    ((TextView) dialogView.findViewById(R.id.value_issuer_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_issuer_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.value_issuer_L)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_issuer_C)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_issuer_ST)).setVisibility(View.GONE);
    ((TextView) dialogView.findViewById(R.id.label_issuer_L)).setVisibility(View.GONE);
}

15. PopUpListAdapter#getView()

View license
/**
	 * Make a view to hold each row.
	 * 
	 * @see android.widget.ListAdapter#getView(int, android.view.View,
	 *      android.view.ViewGroup)
	 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    TextView text;
    if (convertView == null) {
        text = new TextView(ctx);
    } else {
        text = (TextView) convertView;
    }
    AppList bean = data.get(position);
    text.setText(bean.appName);
    bean.drawable.setBounds(0, 0, 60, 60);
    text.setCompoundDrawables(bean.drawable, null, null, null);
    text.setTextSize(18);
    text.setBackgroundColor(Color.parseColor("#303030"));
    text.setPadding(18, 18, 18, 18);
    text.setTextColor(Color.WHITE);
    text.setCompoundDrawablePadding(20);
    text.setGravity(Gravity.CENTER_VERTICAL);
    return text;
}

16. SlidingTabLayout#createDefaultTabView()

Project: afwall
Source File: SlidingTabLayout.java
View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

17. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

18. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

19. FormUtils#getTextViewWith()

View license
public static TextView getTextViewWith(Context context, int textSizeInSp, String text, String key, String type, LinearLayout.LayoutParams layoutParams, String fontPath) {
    TextView textView = new TextView(context);
    textView.setText(text);
    textView.setTag(R.id.key, key);
    textView.setTag(R.id.type, type);
    textView.setId(ViewUtil.generateViewId());
    textView.setTextSize(textSizeInSp);
    textView.setLayoutParams(layoutParams);
    textView.setTypeface(Typeface.createFromAsset(context.getAssets(), fontPath));
    return textView;
}

20. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

21. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

22. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

23. ClassBreaksRendererActivity#updateContent()

View license
/*
	 * Updating the content of the callout with the feature values
	 */
private void updateContent(String station, String country, String temp, String wind_speed) {
    if (calloutView == null)
        return;
    TextView tv_station = (TextView) calloutView.findViewById(R.id.tv_station);
    tv_station.setText(station);
    TextView tv_country = (TextView) calloutView.findViewById(R.id.tv_country);
    tv_country.setText(country);
    TextView tv_temp = (TextView) calloutView.findViewById(R.id.tv_temp);
    tv_temp.setText(temp + "F");
    TextView tv_speed = (TextView) calloutView.findViewById(R.id.tv_speed);
    tv_speed.setText(wind_speed);
}

24. SlidingTabLayout#createDefaultTabView()

Project: from-pc
Source File: SlidingTabLayout.java
View license
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

25. SlidingTabLayout#createDefaultTabView()

Project: iosched
Source File: SlidingTabLayout.java
View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

26. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

27. CanMessageAdapter#getView()

View license
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.can_message_list_item, parent, false);
    }
    CanMessage message = getItem(position);
    TextView timestampView = (TextView) convertView.findViewById(R.id.timestamp);
    timestampView.setText(formatTimestamp(message));
    TextView busView = (TextView) convertView.findViewById(R.id.bus);
    busView.setText("" + message.getBusId());
    TextView idView = (TextView) convertView.findViewById(R.id.id);
    idView.setText("0x" + Integer.toHexString(message.getId()));
    TextView dataView = (TextView) convertView.findViewById(R.id.data);
    dataView.setText("0x" + ByteAdapter.byteArrayToHexString(message.getData()));
    return convertView;
}

28. SlidingTabLayout#createDefaultTabView()

Project: Protocoder
Source File: SlidingTabLayout.java
View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

29. TimePickerDialog#initView()

View license
View initView() {
    LayoutInflater inflater = LayoutInflater.from(getContext());
    View view = inflater.inflate(R.layout.timepicker_layout, null);
    TextView cancel = (TextView) view.findViewById(R.id.tv_cancel);
    cancel.setOnClickListener(this);
    TextView sure = (TextView) view.findViewById(R.id.tv_sure);
    sure.setOnClickListener(this);
    TextView title = (TextView) view.findViewById(R.id.tv_title);
    View toolbar = view.findViewById(R.id.toolbar);
    title.setText(mPickerConfig.mTitleString);
    cancel.setText(mPickerConfig.mCancelString);
    sure.setText(mPickerConfig.mSureString);
    toolbar.setBackgroundColor(mPickerConfig.mThemeColor);
    mTimeWheel = new TimeWheel(view, mPickerConfig);
    return view;
}

30. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

31. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

32. SlidingTabLayout#createDefaultTabView()

Project: vanilla
Source File: SlidingTabLayout.java
View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

33. SlidingTabLayout#createDefaultTabView()

Project: XDA-One
Source File: SlidingTabLayout.java
View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set
     * via
     * [email protected] #setCustomTabView(int, int)}.
     */
@Override
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.setTextColor(Color.WHITE);
    // If we're running on Honeycomb or newer, then we can use the Theme's
    // selectableItemBackground to ensure that the View has a pressed state
    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
    textView.setAllCaps(true);
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

34. TableLayout7#appendRow()

View license
private void appendRow(TableLayout table) {
    TableRow row = new TableRow(this);
    TextView label = new TextView(this);
    label.setText(R.string.table_layout_7_quit);
    label.setPadding(3, 3, 3, 3);
    TextView shortcut = new TextView(this);
    shortcut.setText(R.string.table_layout_7_ctrlq);
    shortcut.setPadding(3, 3, 3, 3);
    shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
    row.addView(label, new TableRow.LayoutParams(1));
    row.addView(shortcut, new TableRow.LayoutParams());
    table.addView(row, new TableLayout.LayoutParams());
}

35. TableLayout8#appendRow()

View license
private void appendRow(TableLayout table) {
    TableRow row = new TableRow(this);
    TextView label = new TextView(this);
    label.setText(R.string.table_layout_8_quit);
    label.setPadding(3, 3, 3, 3);
    TextView shortcut = new TextView(this);
    shortcut.setText(R.string.table_layout_8_ctrlq);
    shortcut.setPadding(3, 3, 3, 3);
    shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
    row.addView(label, new TableRow.LayoutParams(1));
    row.addView(shortcut, new TableRow.LayoutParams());
    table.addView(row, new TableLayout.LayoutParams());
}

36. MainActivity#addTableRow()

View license
private void addTableRow(String id, String key, String val) {
    TableRow tr = new TableRow(this);
    MarginLayoutParams params = new ViewGroup.MarginLayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.setMargins(TABLE_ROW_MARGIN, TABLE_ROW_MARGIN, TABLE_ROW_MARGIN, TABLE_ROW_MARGIN);
    tr.setLayoutParams(params);
    TextView name = new TextView(this);
    name.setGravity(Gravity.RIGHT);
    name.setText(key + ": ");
    TextView value = new TextView(this);
    value.setGravity(Gravity.LEFT);
    value.setText(val);
    value.setTag(id);
    tr.addView(name);
    tr.addView(value);
    tl.addView(tr, params);
}

37. PreferenceCardPresenter#onCreateViewHolder()

View license
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    TextView view = new TextView(parent.getContext());
    view.setLayoutParams(new ViewGroup.LayoutParams(parent.getResources().getInteger(R.integer.preference_square_size), parent.getResources().getInteger(R.integer.preference_square_size)));
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(parent.getContext().getResources().getColor(R.color.default_background));
    view.setTextColor(Color.WHITE);
    view.setGravity(Gravity.CENTER);
    return new ViewHolder(view);
}

38. GridItemPresenter#onCreateViewHolder()

View license
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    TextView view = new TextView(parent.getContext());
    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.grid_item_width);
    int height = res.getDimensionPixelSize(R.dimen.grid_item_height);
    view.setLayoutParams(new ViewGroup.LayoutParams(width, height));
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(mainFragment.getResources().getColor(R.color.default_background, null));
    view.setTextColor(Color.WHITE);
    view.setGravity(Gravity.CENTER);
    return new ViewHolder(view);
}

39. TableLayout7#appendRow()

View license
private void appendRow(TableLayout table) {
    TableRow row = new TableRow(this);
    TextView label = new TextView(this);
    label.setText(R.string.table_layout_7_quit);
    label.setPadding(3, 3, 3, 3);
    TextView shortcut = new TextView(this);
    shortcut.setText(R.string.table_layout_7_ctrlq);
    shortcut.setPadding(3, 3, 3, 3);
    shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
    row.addView(label, new TableRow.LayoutParams(1));
    row.addView(shortcut, new TableRow.LayoutParams());
    table.addView(row, new TableLayout.LayoutParams());
}

40. TableLayout8#appendRow()

View license
private void appendRow(TableLayout table) {
    TableRow row = new TableRow(this);
    TextView label = new TextView(this);
    label.setText(R.string.table_layout_8_quit);
    label.setPadding(3, 3, 3, 3);
    TextView shortcut = new TextView(this);
    shortcut.setText(R.string.table_layout_8_ctrlq);
    shortcut.setPadding(3, 3, 3, 3);
    shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);
    row.addView(label, new TableRow.LayoutParams(1));
    row.addView(shortcut, new TableRow.LayoutParams());
    table.addView(row, new TableLayout.LayoutParams());
}

41. DebugHierarchyViewContainer#getTextView()

View license
private TextView getTextView(DebugFragmentRecord fragmentRecord, int hierarchy) {
    TextView tvItem = new TextView(mContext);
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mItemHeight);
    tvItem.setLayoutParams(params);
    if (hierarchy == 0) {
        tvItem.setTextColor(Color.BLACK);
        tvItem.setTextSize(16);
    }
    tvItem.setGravity(Gravity.CENTER_VERTICAL);
    tvItem.setPadding((int) (mPadding + hierarchy * mPadding * 1.5), 0, mPadding, 0);
    tvItem.setCompoundDrawablePadding(mPadding / 2);
    TypedArray a = mContext.obtainStyledAttributes(new int[] { android.R.attr.selectableItemBackground });
    tvItem.setBackgroundDrawable(a.getDrawable(0));
    a.recycle();
    tvItem.setText(fragmentRecord.fragmentName);
    return tvItem;
}

42. SlidingTabLayout#createDefaultTabView()

Project: holdr
Source File: SlidingTabLayout.java
View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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(R.attr.selectableItemBackground, outValue, true);
    textView.setBackgroundResource(outValue.resourceId);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        textView.setAllCaps(true);
    }
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

43. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        textView.setAllCaps(true);
    }
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

44. MainActivity#initActivitySlideLayout()

Project: SlideLayout
Source File: MainActivity.java
View license
private void initActivitySlideLayout() {
    sl_activity = new SlideLayout(this, null, R.style.SlideLayoutStyle2Demo);
    TextView v = (TextView) LayoutInflater.from(this).inflate(R.layout.layout_text, null);
    v.setBackgroundColor(0xFFFF0000);
    v.setText("Left Menu");
    sl_activity.addView(v);
    v = (TextView) LayoutInflater.from(this).inflate(R.layout.layout_text, null);
    v.setBackgroundColor(0xFF00FF00);
    v.setText("Right Menu");
    sl_activity.addView(v);
    v = (TextView) LayoutInflater.from(this).inflate(R.layout.layout_text, null);
    v.setBackgroundColor(0xFF0000FF);
    v.setText("Bottom Menu");
    sl_activity.addView(v);
    sl_activity.attachToActivity(this, true);
}

45. SimpleTableDataAdapter#getCellView()

View license
@Override
public View getCellView(final int rowIndex, final int columnIndex, final ViewGroup parentView) {
    final TextView textView = new TextView(getContext());
    textView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    textView.setTypeface(textView.getTypeface(), typeface);
    textView.setTextSize(textSize);
    textView.setTextColor(textColor);
    textView.setSingleLine();
    textView.setEllipsize(TextUtils.TruncateAt.END);
    try {
        final String textToShow = getItem(rowIndex)[columnIndex];
        textView.setText(textToShow);
    } catch (final IndexOutOfBoundsException e) {
        Log.w(LOG_TAG, "No Sting given for row " + rowIndex + ", column " + columnIndex + ". " + "Caught exception: " + e.toString());
    }
    return textView;
}

46. SimpleTableHeaderAdapter#getHeaderView()

View license
@Override
public View getHeaderView(final int columnIndex, final ViewGroup parentView) {
    final TextView textView = new TextView(getContext());
    if (columnIndex < headers.length) {
        textView.setText(headers[columnIndex]);
    }
    textView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    textView.setTypeface(textView.getTypeface(), typeface);
    textView.setTextSize(textSize);
    textView.setTextColor(textColor);
    textView.setSingleLine();
    textView.setEllipsize(TextUtils.TruncateAt.END);
    return textView;
}

47. SlidingTabLayout#createDefaultTabView()

View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        textView.setAllCaps(true);
    }
    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);
    return textView;
}

48. AppToast#show()

Project: SwipeCardView
Source File: AppToast.java
View license
public static void show(Context context, int color, CharSequence string, int duration) {
    if (context == null)
        return;
    DisplayMetrics dm = context.getResources().getDisplayMetrics();
    float density = dm.density;
    Toast toast = new Toast(context);
    toast.setDuration(duration);
    toast.setGravity(Gravity.TOP, 0, (int) (48 * density));
    FrameLayout frame = new FrameLayout(context);
    frame.setPadding(0, 0, 0, 0);
    int width = dm.widthPixels;
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(width, FrameLayout.LayoutParams.WRAP_CONTENT);
    TextView text = new TextView(context);
    text.setMinimumHeight((int) (28 * density));
    text.setGravity(Gravity.CENTER);
    text.setTextColor(Color.WHITE);
    text.setTextSize(14);
    frame.addView(text, params);
    toast.setView(frame);
    text.setBackgroundColor(color);
    text.setText(string);
    toast.show();
}

49. ActionBarOwnFontActivity#setActionBarTitle()

View license
private void setActionBarTitle(String actionBarTitle) {
    this.getSupportActionBar().setDisplayShowCustomEnabled(true);
    this.getSupportActionBar().setDisplayShowTitleEnabled(false);
    LayoutInflater inflator = LayoutInflater.from(this);
    View v = inflator.inflate(R.layout.example_action_bar_own_font, null);
    Typeface tf = Typeface.createFromAsset(getAssets(), "font/BlackwoodCastle.ttf");
    TextView title1 = (TextView) v.findViewById(R.id.titleFragment1);
    title1.setTypeface(tf);
    TextView title2 = (TextView) v.findViewById(R.id.titleFragment2);
    title2.setTypeface(tf);
    int split = (actionBarTitle.length() / 2);
    title1.setText(actionBarTitle.substring(0, split));
    title2.setText(actionBarTitle.substring(split));
    //assign the view to the actionbar
    this.getSupportActionBar().setCustomView(v);
}

50. PagerSlidingTabStrip#addTextTab()

View license
private void addTextTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setText(title);
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });
    tabsContainer.addView(tab);
}

51. BaseChartListAdapter#createTextView()

Project: andlytics
Source File: BaseChartListAdapter.java
View license
@SuppressWarnings("deprecation")
private TextView createTextView(String string, boolean bold, boolean weight) {
    TextView view = new TextView(activity);
    view.setText(string);
    int top = (int) (2 * scale);
    int left = (int) (2 * scale);
    view.setPadding(left, top, left, top);
    view.setTextColor(activity.getResources().getColor(R.color.blackText));
    if (weight) {
        view.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, .2f));
    } else {
        view.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    }
    view.setGravity(Gravity.RIGHT);
    if (bold) {
        view.setTypeface(view.getTypeface(), Typeface.BOLD);
    }
    view.setTextSize(TypedValue.COMPLEX_UNIT_PX, listItemTextSize);
    return view;
}

52. ViewPagerIndicator#generateTextView()

View license
/**
	 * ??title??Tab
	 * 
	 * @param title
	 * @return
	 */
private View generateTextView(String title) {
    TextView tv = new TextView(getContext());
    LinearLayout.LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    lp.width = getScreenWidth() / mTabVisibleCount;
    tv.setText(title);
    tv.setGravity(Gravity.CENTER);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    tv.setTextColor(COLOR_TEXT_NORMAL);
    tv.setLayoutParams(lp);
    return tv;
}

53. MainActivity#getIndicatorView()

Project: AndroidReview
Source File: MainActivity.java
View license
/** ??????????
     * @param indicator1
     * @return
     */
private View getIndicatorView(Indicator indicator1) {
    View view = LayoutInflater.from(this).inflate(R.layout.tab_indicator, null);
    TextView indicator = (TextView) view.findViewById(R.id.tab_title);
    indicator.setText(getString(indicator1.getResName()));
    indicator.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
    Drawable icon = this.getResources().getDrawable(indicator1.getResIcon());
    //        ???ICON??
    //        icon.setBounds(0, 0, 75, 75);
    //        indicator.setCompoundDrawables(null,icon,null,null);
    indicator.setCompoundDrawablePadding(3);
    indicator.setCompoundDrawablesWithIntrinsicBounds(null, icon, null, null);
    indicator.setPadding(0, 8, 0, 5);
    return view;
}

54. SocialViewHolder#createNodeView()

View license
@Override
public View createNodeView(TreeNode node, SocialItem value) {
    final LayoutInflater inflater = LayoutInflater.from(context);
    final View view = inflater.inflate(R.layout.layout_social_node, null, false);
    final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
    iconView.setIconText(context.getResources().getString(value.icon));
    TextView connectionsLabel = (TextView) view.findViewById(R.id.connections);
    Random r = new Random();
    connectionsLabel.setText(r.nextInt(150) + " connections");
    TextView userNameLabel = (TextView) view.findViewById(R.id.username);
    userNameLabel.setText(NAMES[r.nextInt(4)]);
    TextView sizeText = (TextView) view.findViewById(R.id.size);
    sizeText.setText(r.nextInt(10) + " items");
    return view;
}

55. DeviceDetailsActivity#appendAdRecordView()

View license
private void appendAdRecordView(final MergeAdapter adapter, final String title, final AdRecord record) {
    final LinearLayout lt = (LinearLayout) getLayoutInflater().inflate(R.layout.list_item_view_adrecord, null);
    final TextView tvString = (TextView) lt.findViewById(R.id.data_as_string);
    final TextView tvArray = (TextView) lt.findViewById(R.id.data_as_array);
    final TextView tvTitle = (TextView) lt.findViewById(R.id.title);
    tvTitle.setText(title);
    tvString.setText("'" + AdRecordUtils.getRecordDataAsString(record) + "'");
    tvArray.setText("'" + ByteUtils.byteArrayToHexString(record.getData()) + "'");
    adapter.addView(lt);
}

56. EditUserActivity#onCreate()

Project: BotLibre
Source File: EditUserActivity.java
View license
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_user);
    UserConfig user = MainActivity.user;
    setTitle("Edit: " + user.user);
    TextView text = (EditText) findViewById(R.id.hintText);
    text.setText(user.hint);
    text = (EditText) findViewById(R.id.nameText);
    text.setText(user.name);
    text = (EditText) findViewById(R.id.emailText);
    text.setText(user.email);
    text = (EditText) findViewById(R.id.websiteText);
    text.setText(user.website);
    text = (EditText) findViewById(R.id.bioText);
    text.setText(user.bio);
    CheckBox checkbox = (CheckBox) findViewById(R.id.showNameCheckBox);
    checkbox.setChecked(user.showName);
}

57. EditUserActivity#onCreate()

Project: BotLibre
Source File: EditUserActivity.java
View license
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_user);
    UserConfig user = MainActivity.user;
    setTitle("Edit: " + user.user);
    TextView text = (EditText) findViewById(R.id.hintText);
    text.setText(user.hint);
    text = (EditText) findViewById(R.id.nameText);
    text.setText(user.name);
    text = (EditText) findViewById(R.id.emailText);
    text.setText(user.email);
    text = (EditText) findViewById(R.id.websiteText);
    text.setText(user.website);
    text = (EditText) findViewById(R.id.bioText);
    text.setText(user.bio);
    CheckBox checkbox = (CheckBox) findViewById(R.id.showNameCheckBox);
    checkbox.setChecked(user.showName);
}

58. MyMsgAdapter#getView()

Project: Conquer
Source File: MyMsgAdapter.java
View license
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = View.inflate(context, R.layout.item_mymsg, null);
    }
    ImageView iv_photo = ViewHolder.get(convertView, R.id.iv_photo);
    TextView tv_cotent = ViewHolder.get(convertView, R.id.tv_cotent);
    TextView tv_time = ViewHolder.get(convertView, R.id.tv_time);
    TextView tv_nickname = ViewHolder.get(convertView, R.id.tv_nickname);
    TextView tv_reply = ViewHolder.get(convertView, R.id.tv_reply);
    MyMsg msg = (MyMsg) list.get(position);
    loder.displayImage(msg.getUser().getAvatar(), iv_photo);
    tv_nickname.setText(msg.getUser().getNick());
    tv_cotent.setText(msg.getContent());
    return convertView;
}

59. AboutFragment#onViewCreated()

Project: Crouton
Source File: AboutFragment.java
View license
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final String gitHubLink = createLink(getString(R.string.repo_url), "GitHub");
    TextView credits = (TextView) view.findViewById(R.id.credits);
    credits.setText(Html.fromHtml(getString(R.string.credits, createLink(getString(R.string.gplus_url), "Benjamin Weiss"))));
    TextView feedback = (TextView) view.findViewById(R.id.feedback);
    feedback.setText(Html.fromHtml(getString(R.string.feedback, gitHubLink)));
    TextView attributions = (TextView) view.findViewById(R.id.attributions);
    attributions.setText(Html.fromHtml(getString(R.string.attributions, createLink("http://www.apache.org/licenses/LICENSE-2.0 ", "Apache License, V2"), gitHubLink)));
    setLinkMovementMethod(credits, feedback, attributions);
}

60. ContactsUtils3#bindContactPhoneView()

Project: CSipSimple
Source File: ContactsUtils3.java
View license
@Override
public void bindContactPhoneView(View view, Context context, Cursor cursor) {
    // Get values
    String value = cursor.getString(cursor.getColumnIndex(Phones.NUMBER));
    String displayName = cursor.getString(cursor.getColumnIndex(Phones.DISPLAY_NAME));
    Long peopleId = cursor.getLong(cursor.getColumnIndex(Phones.PERSON_ID));
    Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, peopleId);
    Bitmap bitmap = getContactPhoto(context, uri, false, R.drawable.ic_contact_picture_holo_dark);
    // Get views
    TextView tv = (TextView) view.findViewById(R.id.name);
    TextView sub = (TextView) view.findViewById(R.id.number);
    TextView label = (TextView) view.findViewById(R.id.label);
    ImageView imageView = (ImageView) view.findViewById(R.id.contact_photo);
    // Bind
    label.setVisibility(View.GONE);
    view.setTag(value);
    tv.setText(displayName);
    sub.setText(value);
    imageView.setImageBitmap(bitmap);
}

61. RepositoryListAdapter#getView()

Project: DroidPHP
Source File: RepositoryListAdapter.java
View license
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater mInflater = LayoutInflater.from(context);
        convertView = mInflater.inflate(R.layout.repository_list_item, null);
    }
    Repository repo = repositories.get(position);
    TextView repositoryName = (TextView) convertView.findViewById(R.id.txt_repository_name);
    repositoryName.setText(repo.getName());
    TextView tv_filesize = (TextView) convertView.findViewById(R.id.txt_repository_size);
    tv_filesize.setText(String.format("SIZE : %s", Formatter.formatFileSize(context, repo.getSize())));
    TextView tv_copyto = (TextView) convertView.findViewById(R.id.txt_repository_copyto);
    tv_copyto.setText(String.format("INSTALL : %s", repo.getCopyPath()));
    convertView.findViewById(R.id.repository_ll).setOnClickListener(new DownloadEventListener(position));
    return convertView;
}

62. SimpleHomeAdapter#getView()

View license
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    int padding = (int) (dm.density * 10);
    TextView tv = new TextView(context);
    tv.setText(items[position]);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    tv.setTextColor(Color.parseColor("#468ED0"));
    // tv.setGravity(Gravity.CENTER);
    tv.setPadding(padding, padding, padding, padding);
    AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT);
    tv.setLayoutParams(lp);
    return tv;
}

63. SimpleHomeAdapter#getView()

View license
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    int padding = (int) (mDisplayMetrics.density * 10);
    TextView tv = new TextView(mContext);
    tv.setText(mItems[position]);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    tv.setTextColor(Color.parseColor("#468ED0"));
    // tv.setGravity(Gravity.CENTER);
    tv.setPadding(padding, padding, padding, padding);
    AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT);
    tv.setLayoutParams(lp);
    return tv;
}

64. OField#getLabelView()

Project: framework
Source File: OField.java
View license
private TextView getLabelView() {
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    TextView label = new TextView(mContext);
    if (labelSize > -1) {
        label.setTextSize(TypedValue.COMPLEX_UNIT_PX, labelSize);
    }
    if (labelAppearance > -1) {
        label.setTextAppearance(mContext, labelAppearance);
    }
    label.setTextColor(labelColor);
    label.setLayoutParams(params);
    label.setGravity(Gravity.LEFT);
    label.setText(getLabelText());
    label.setAllCaps(true);
    return label;
}

65. ReactionsView#init()

Project: Gitskarios
Source File: ReactionsView.java
View license
private void init() {
    inflate(getContext(), R.layout.reactions_layout, this);
    setOrientation(HORIZONTAL);
    TextView reaction1 = (TextView) findViewById(R.id.reaction1);
    TextView reaction2 = (TextView) findViewById(R.id.reaction2);
    TextView reaction3 = (TextView) findViewById(R.id.reaction3);
    TextView reaction4 = (TextView) findViewById(R.id.reaction4);
    TextView reaction5 = (TextView) findViewById(R.id.reaction5);
    TextView reaction6 = (TextView) findViewById(R.id.reaction6);
    reactions = new TextView[] { reaction1, reaction2, reaction3, reaction4, reaction5, reaction6 };
}

66. AnnouncementFragment#showAnnouncementDetail()

View license
@Override
public void showAnnouncementDetail(DetailAnnouncement detailAnnouncement) {
    mAnnouncementDetail = detailAnnouncement;
    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getContext());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View dialogView = inflater.inflate(R.layout.detail_annoucement_dialog_layout, null);
    dialogBuilder.setView(dialogView);
    TextView title = ButterKnife.findById(dialogView, R.id.tvDialogTitle);
    TextView date = ButterKnife.findById(dialogView, R.id.tvDialogDate);
    TextView author = ButterKnife.findById(dialogView, R.id.tvDialogAuthor);
    WebView text = ButterKnife.findById(dialogView, R.id.wvDialogText);
    Button buttonOk = ButterKnife.findById(dialogView, R.id.bDialogOK);
    buttonOk.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            alertDialog.dismiss();
        }
    });
    text.loadDataWithBaseURL("", mAnnouncementDetail.getText(), "text/html", "utf-8", "");
    date.setText(mAnnouncementDetail.getDate());
    title.setText(mAnnouncementDetail.getTitle());
    author.setText(mAnnouncementDetail.getAuthor().getContent());
    alertDialog = dialogBuilder.create();
    alertDialog.show();
}

67. SubFloorFactory#buildSubFloor()

Project: JianDan
Source File: SubFloorFactory.java
View license
public View buildSubFloor(Commentable cmt, ViewGroup group) {
    LayoutInflater inflater = (LayoutInflater) group.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.item_comment_floor, null);
    RelativeLayout show = (RelativeLayout) view.findViewById(R.id.show_sub_floor_content);
    RelativeLayout hide = (RelativeLayout) view.findViewById(R.id.hide_sub_floor_content);
    show.setVisibility(View.VISIBLE);
    hide.setVisibility(View.GONE);
    TextView floorNum = (TextView) view.findViewById(R.id.sub_floor_num);
    TextView username = (TextView) view.findViewById(R.id.sub_floor_username);
    TextView content = (TextView) view.findViewById(R.id.sub_floor_content);
    floorNum.setText(String.valueOf(cmt.getCommentFloorNum()));
    username.setText(cmt.getAuthorName());
    content.setText(cmt.getCommentContent());
    return view;
}

68. SubFloorFactory#buildSubFloor()

Project: JianDanRxJava
Source File: SubFloorFactory.java
View license
public View buildSubFloor(Commentable cmt, ViewGroup group) {
    LayoutInflater inflater = (LayoutInflater) group.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.item_comment_floor, null);
    RelativeLayout show = (RelativeLayout) view.findViewById(R.id.show_sub_floor_content);
    RelativeLayout hide = (RelativeLayout) view.findViewById(R.id.hide_sub_floor_content);
    show.setVisibility(View.VISIBLE);
    hide.setVisibility(View.GONE);
    TextView floorNum = (TextView) view.findViewById(R.id.sub_floor_num);
    TextView username = (TextView) view.findViewById(R.id.sub_floor_username);
    TextView content = (TextView) view.findViewById(R.id.sub_floor_content);
    floorNum.setText(String.valueOf(cmt.getCommentFloorNum()));
    username.setText(cmt.getAuthorName());
    content.setText(cmt.getCommentContent());
    return view;
}

69. AlertDialogsHelper#getTextDialog()

Project: LeafPic
Source File: AlertDialogsHelper.java
View license
public static AlertDialog getTextDialog(final ThemedActivity activity, AlertDialog.Builder textDialogBuilder, String title, String Message) {
    View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_text, null);
    TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.text_dialog_title);
    TextView dialogMessage = (TextView) dialogLayout.findViewById(R.id.text_dialog_message);
    ((CardView) dialogLayout.findViewById(R.id.message_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
    dialogTitle.setBackgroundColor(activity.getPrimaryColor());
    dialogTitle.setText(title);
    dialogMessage.setText(Message);
    dialogMessage.setTextColor(activity.getTextColor());
    textDialogBuilder.setView(dialogLayout);
    return textDialogBuilder.create();
}

70. AlertDialogsHelper#getProgressDialog()

Project: LeafPic
Source File: AlertDialogsHelper.java
View license
public static AlertDialog getProgressDialog(final ThemedActivity activity, AlertDialog.Builder progressDialog, String title, String message) {
    View dialogLayout = activity.getLayoutInflater().inflate(R.layout.dialog_progress, null);
    TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.progress_dialog_title);
    TextView dialogMessage = (TextView) dialogLayout.findViewById(R.id.progress_dialog_text);
    dialogTitle.setBackgroundColor(activity.getPrimaryColor());
    ((CardView) dialogLayout.findViewById(R.id.progress_dialog_card)).setCardBackgroundColor(activity.getCardBackgroundColor());
    ((ProgressBar) dialogLayout.findViewById(R.id.progress_dialog_loading)).getIndeterminateDrawable().setColorFilter(activity.getPrimaryColor(), android.graphics.PorterDuff.Mode.SRC_ATOP);
    dialogTitle.setText(title);
    dialogMessage.setText(message);
    dialogMessage.setTextColor(activity.getTextColor());
    progressDialog.setCancelable(false);
    progressDialog.setView(dialogLayout);
    return progressDialog.create();
}

71. TwitterConfigActivity#onCreate()

Project: MindRDR
Source File: TwitterConfigActivity.java
View license
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_twitter_config);
    Intent intent = getIntent();
    String token = intent.getStringExtra("token");
    String secret = intent.getStringExtra("secret");
    TextView secretTxt = (TextView) findViewById(R.id.secret_txt);
    TextView tokenTxt = (TextView) findViewById(R.id.token_txt);
    tokenTxt.setText("Token: " + token);
    secretTxt.setText("Secret:" + secret);
    OAuthData oAuthData = OAuthData.getInstance();
    oAuthData.setAccessToken(this, token);
    oAuthData.setAccessTokenSecret(this, secret);
    TextView finished_txt = (TextView) findViewById(R.id.finished_txt);
    finished_txt.setText("All Done!");
}

72. PeekLayoutFactory#createClockLayout()

View license
private static View createClockLayout(Context context) {
    TextView clockText = new TextView(context);
    clockText.setTextAppearance(context, android.R.style.TextAppearance_Holo_Large);
    clockText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 32);
    clockText.setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL));
    clockText.setGravity(Gravity.CENTER);
    RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    relativeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
    relativeLayoutParams.topMargin = context.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin);
    clockText.setLayoutParams(relativeLayoutParams);
    return clockText;
}

73. MyPagerAdapter#instantiateItem()

View license
@Override
public Object instantiateItem(ViewGroup container, int position) {
    TextView item = new TextView(container.getContext());
    item.setText(Integer.toString(position + 1));
    item.setTextColor(Color.argb(192, 255, 255, 255));
    item.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 50);
    item.setGravity(Gravity.CENTER);
    item.setBackgroundColor(COLORS[position % COLORS.length]);
    ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    container.addView(item, layoutParams);
    return item;
}

74. SingleParallaxExpandableListView#onCreate()

View license
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.expand_list_one_parallax);
    ParallaxExpandableListView listView = (ParallaxExpandableListView) findViewById(R.id.list_view);
    TextView v = new TextView(this);
    v.setText("PARALLAXED");
    v.setGravity(Gravity.CENTER);
    v.setTextSize(40);
    v.setHeight(200);
    v.setBackgroundResource(R.drawable.item_background);
    listView.addParallaxedHeaderView(v);
    CustomExpandableListAdapter adapter = new CustomExpandableListAdapter(LayoutInflater.from(this));
    listView.setAdapter(adapter);
}

75. SingleParallaxListView#onCreate()

View license
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_one_parallax);
    ParallaxListView listView = (ParallaxListView) findViewById(R.id.list_view);
    CustomListAdapter adapter = new CustomListAdapter(LayoutInflater.from(this));
    TextView v = new TextView(this);
    v.setText("PARALLAXED");
    v.setGravity(Gravity.CENTER);
    v.setTextSize(40);
    v.setHeight(200);
    v.setBackgroundResource(R.drawable.item_background);
    listView.addParallaxedHeaderView(v);
    listView.setAdapter(adapter);
}

76. ImageInfographicUtils#createDurationView()

View license
public TextView createDurationView(long duration, Context context) {
    TextView tv = new TextView(context);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 19);
    tv.setText(timeUtil.formatDurationHoursMinutes(duration));
    tv.setTypeface(Typeface.DEFAULT_BOLD);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.rightMargin = 10;
    params.gravity = Gravity.CENTER_VERTICAL;
    tv.setLayoutParams(params);
    tv.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
    return tv;
}

77. RecipientsAdapter#bindView()

Project: Silence
Source File: RecipientsAdapter.java
View license
@Override
public final void bindView(View view, Context context, Cursor cursor) {
    TextView name = (TextView) view.findViewById(R.id.name);
    name.setText(cursor.getString(NAME_INDEX));
    TextView label = (TextView) view.findViewById(R.id.label);
    int type = cursor.getInt(TYPE_INDEX);
    label.setText(mContactAccessor.phoneTypeToString(mContext, type, cursor.getString(LABEL_INDEX)));
    TextView number = (TextView) view.findViewById(R.id.number);
    number.setText("(" + cursor.getString(NUMBER_INDEX) + ")");
}

78. TagsEditText#createTextView()

Project: TagsEditText
Source File: TagsEditText.java
View license
private TextView createTextView(String text) {
    TextView textView = new TextView(getContext());
    if (getWidth() > 0) {
        textView.setMaxWidth(getWidth() - 50);
    }
    textView.setText(text);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTagsTextSize);
    textView.setTextColor(mTagsTextColor);
    // check Android version for set background
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        textView.setBackground(mTagsBackground);
    } else {
        textView.setBackgroundDrawable(mTagsBackground);
    }
    textView.setCompoundDrawablesWithIntrinsicBounds(mLeftDrawable, null, mRightDrawable, null);
    textView.setCompoundDrawablePadding(mDrawablePadding);
    return textView;
}

79. SingleParallaxExpandableListView#onCreate()

View license
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.parallax_scroll_expand_list_one_parallax);
    ParallaxExpandableListView listView = (ParallaxExpandableListView) findViewById(R.id.list_view);
    TextView v = new TextView(this);
    v.setText("PARALLAXED");
    v.setGravity(Gravity.CENTER);
    v.setTextSize(40);
    v.setHeight(200);
    v.setBackgroundResource(R.drawable.parallax_scroll_item_background);
    listView.addParallaxedHeaderView(v);
    CustomExpandableListAdapter adapter = new CustomExpandableListAdapter(LayoutInflater.from(this));
    listView.setAdapter(adapter);
}

80. SingleParallaxListView#onCreate()

View license
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.parallax_scroll_list_one_parallax);
    ParallaxListView listView = (ParallaxListView) findViewById(R.id.list_view);
    CustomListAdapter adapter = new CustomListAdapter(LayoutInflater.from(this));
    TextView v = new TextView(this);
    v.setText("PARALLAXED");
    v.setGravity(Gravity.CENTER);
    v.setTextSize(40);
    v.setHeight(200);
    v.setBackgroundResource(R.drawable.parallax_scroll_item_background);
    listView.addParallaxedHeaderView(v);
    listView.setAdapter(adapter);
}

81. SuperAwesomeCardFragment#onCreateView()

View license
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);
    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setBackgroundResource(R.drawable.view_sliding_tab_background_card);
    v.setText("CARD " + (position + 1));
    fl.addView(v);
    return fl;
}

82. SingleParallaxExpandableListView#onCreate()

View license
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.parallax_scroll_expand_list_one_parallax);
    ParallaxExpandableListView listView = (ParallaxExpandableListView) findViewById(R.id.list_view);
    TextView v = new TextView(this);
    v.setText("PARALLAXED");
    v.setGravity(Gravity.CENTER);
    v.setTextSize(40);
    v.setHeight(200);
    v.setBackgroundResource(R.drawable.parallax_scroll_item_background);
    listView.addParallaxedHeaderView(v);
    CustomExpandableListAdapter adapter = new CustomExpandableListAdapter(LayoutInflater.from(this));
    listView.setAdapter(adapter);
}

83. SingleParallaxListView#onCreate()

View license
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.parallax_scroll_list_one_parallax);
    ParallaxListView listView = (ParallaxListView) findViewById(R.id.list_view);
    CustomListAdapter adapter = new CustomListAdapter(LayoutInflater.from(this));
    TextView v = new TextView(this);
    v.setText("PARALLAXED");
    v.setGravity(Gravity.CENTER);
    v.setTextSize(40);
    v.setHeight(200);
    v.setBackgroundResource(R.drawable.parallax_scroll_item_background);
    listView.addParallaxedHeaderView(v);
    listView.setAdapter(adapter);
}

84. SuperAwesomeCardFragment#onCreateView()

View license
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);
    final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics());
    TextView v = new TextView(getActivity());
    params.setMargins(margin, margin, margin, margin);
    v.setLayoutParams(params);
    v.setLayoutParams(params);
    v.setGravity(Gravity.CENTER);
    v.setBackgroundResource(R.drawable.view_sliding_tab_background_card);
    v.setText("CARD " + (position + 1));
    fl.addView(v);
    return fl;
}

85. MainActivity#onCreate()

View license
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.activity_main);
    final TextView checkItOutOnGitHubTextView = (TextView) this.findViewById(R.id.check_it_out_on_github);
    checkItOutOnGitHubTextView.setMovementMethod(LinkMovementMethod.getInstance());
    checkItOutOnGitHubTextView.setText(Html.fromHtml(this.getString(R.string.check_it_out_on_github)));
    final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    final TextView bodySizeTextView = (TextView) this.findViewById(R.id.body_size);
    bodySizeTextView.setTextSize(sharedPreferences.getInt("preference_font_size", this.getResources().getInteger(R.integer.font_size_default_value)));
    bodySizeTextView.setText(this.getString(R.string.body_size).concat(" - " + sharedPreferences.getInt("preference_body_size", DEFAULT_BODY_SIZE)));
}

86. MainActivity#addView()

Project: WhatsappFormatter
Source File: MainActivity.java
View license
private void addView() {
    String text = mEditText.getText().toString();
    TextView textView = new TextView(this);
    textView.setBackgroundResource(R.drawable.ic_whatsapp_chathead);
    textView.setText(text);
    textView.setPadding(10, 10, 40, 10);
    mContainer.addView(textView);
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textView.getLayoutParams();
    layoutParams.gravity = Gravity.END;
    layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT;
    layoutParams.topMargin = layoutParams.rightMargin = layoutParams.bottomMargin = layoutParams.leftMargin = 20;
    textView.setGravity(Gravity.START | Gravity.CENTER);
    textView.setLayoutParams(layoutParams);
    WhatsappViewCompat.applyFormatting(textView);
    mEditText.setText("");
}

87. ConversationTabLayout#createDefaultTabView()

Project: Yaaic
Source File: ConversationTabLayout.java
View license
/**
     * Create a default view to be used for tabs. This is called if a custom tab view is not set via
     * [email protected] #setCustomTabView(int, int)}.
     */
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.setTextColor(0xFFFFFFFF);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        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;
}

88. TextTagsAdapter#getView()

View license
@Override
public View getView(final Context context, final int position, ViewGroup parent) {
    TextView tv = new TextView(context);
    tv.setText("No." + position);
    tv.setGravity(Gravity.CENTER);
    tv.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.e("Click", "Tag " + position + " clicked.");
            Toast.makeText(context, "Tag " + position + " clicked", Toast.LENGTH_SHORT).show();
        }
    });
    tv.setTextColor(Color.WHITE);
    return tv;
}

89. IdleExitTestActivity#onCreateTextView()

Project: AcDisplay
Source File: IdleExitTestActivity.java
View license
@NonNull
private TextView onCreateTextView() {
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
    lp.weight = 1;
    TextView textView = new TextView(this);
    textView.setLayoutParams(lp);
    textView.setOnClickListener(this);
    textView.setGravity(Gravity.CENTER);
    textView.setBackgroundColor(Color.RED);
    return textView;
}

90. ShakeTestActivity#onCreateTextView()

Project: AcDisplay
Source File: ShakeTestActivity.java
View license
@NonNull
private TextView onCreateTextView() {
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
    lp.weight = 1;
    TextView textView = new TextView(this);
    textView.setLayoutParams(lp);
    textView.setOnClickListener(this);
    textView.setGravity(Gravity.CENTER);
    textView.setBackgroundColor(Color.RED);
    return textView;
}

91. IcsToast#makeText()

Project: ActionBarSherlock
Source File: IcsToast.java
View license
public static Toast makeText(Context context, CharSequence s, int duration) {
    if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
        return Toast.makeText(context, s, duration);
    }
    IcsToast toast = new IcsToast(context);
    toast.setDuration(duration);
    TextView view = new TextView(context);
    view.setText(s);
    // Original AOSP using reference on @android:color/bright_foreground_dark
    // bright_foreground_dark - reference on @android:color/background_light
    // background_light - 0xffffffff
    view.setTextColor(0xffffffff);
    view.setGravity(Gravity.CENTER);
    view.setBackgroundResource(R.drawable.abs__toast_frame);
    toast.setView(view);
    return toast;
}

92. TestFragment#onCreateView()

View license
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
        mContent = savedInstanceState.getString(KEY_CONTENT);
    }
    TextView text = new TextView(getActivity());
    text.setText(mContent);
    text.setTextSize(20 * getResources().getDisplayMetrics().density);
    text.setPadding(20, 20, 20, 20);
    text.setGravity(Gravity.CENTER);
    LinearLayout layout = new LinearLayout(getActivity());
    layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    layout.setGravity(Gravity.CENTER);
    layout.addView(text);
    return layout;
}

93. ListActivitySample#onCreate()

View license
@Override
public void onCreate(Bundle inState) {
    super.onCreate(inState);
    mMenuDrawer = MenuDrawer.attach(this);
    mMenuDrawer.setSlideDrawable(R.drawable.ic_drawer);
    mMenuDrawer.setDrawerIndicatorEnabled(true);
    TextView menuView = new TextView(this);
    menuView.setGravity(Gravity.CENTER);
    menuView.setTextColor(0xFFFFFFFF);
    final int padding = dpToPx(16);
    menuView.setPadding(padding, padding, padding, padding);
    menuView.setText(R.string.sample_listactivity);
    mMenuDrawer.setMenuView(menuView);
    mMenuDrawer.setOffsetMenuEnabled(false);
    List<String> items = new ArrayList<String>();
    for (int i = 1; i <= 20; i++) {
        items.add("Item " + i);
    }
    setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items));
}

94. TestFragment#onCreateView()

View license
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    TextView text = new TextView(getActivity());
    text.setGravity(Gravity.CENTER);
    text.setText(mContent);
    text.setTextSize(20 * getResources().getDisplayMetrics().density);
    text.setPadding(20, 20, 20, 20);
    LinearLayout layout = new LinearLayout(getActivity());
    layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    layout.setGravity(Gravity.CENTER);
    layout.addView(text);
    return layout;
}

95. ArticleListFragment#dynamicAddTitleView()

View license
private void dynamicAddTitleView() {
    TextView textView = new TextView(getActivity());
    textView.setText("Small Article (??new)");
    RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    param.addRule(RelativeLayout.CENTER_IN_PARENT);
    textView.setLayoutParams(param);
    textView.setTextColor(getActivity().getResources().getColor(R.color.color_title_bar_text));
    textView.setTextSize(20);
    titleBarLayout.addView(textView);
    List<DynamicAttr> mDynamicAttr = new ArrayList<DynamicAttr>();
    mDynamicAttr.add(new DynamicAttr(AttrFactory.TEXT_COLOR, R.color.color_title_bar_text));
    dynamicAddView(textView, mDynamicAttr);
}

96. ArticleListFragment#dynamicAddTitleView()

View license
private void dynamicAddTitleView() {
    TextView textView = new TextView(getActivity());
    textView.setText("Small Article (??new)");
    RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    param.addRule(RelativeLayout.CENTER_IN_PARENT);
    textView.setLayoutParams(param);
    textView.setTextColor(getActivity().getResources().getColor(R.color.color_title_bar_text));
    textView.setTextSize(20);
    titleBarLayout.addView(textView);
    List<DynamicAttr> mDynamicAttr = new ArrayList<DynamicAttr>();
    mDynamicAttr.add(new DynamicAttr(AttrFactory.TEXT_COLOR, R.color.color_title_bar_text));
    dynamicAddView(textView, mDynamicAttr);
}

97. TextCellFactory#createCellHolder()

Project: Atlas-Android
Source File: TextCellFactory.java
View license
@Override
public CellHolder createCellHolder(ViewGroup cellView, boolean isMe, LayoutInflater layoutInflater) {
    View v = layoutInflater.inflate(R.layout.atlas_message_item_cell_text, cellView, true);
    v.setBackgroundResource(isMe ? R.drawable.atlas_message_item_cell_me : R.drawable.atlas_message_item_cell_them);
    ((GradientDrawable) v.getBackground()).setColor(isMe ? mMessageStyle.getMyBubbleColor() : mMessageStyle.getOtherBubbleColor());
    TextView t = (TextView) v.findViewById(R.id.cell_text);
    t.setTextSize(TypedValue.COMPLEX_UNIT_PX, isMe ? mMessageStyle.getMyTextSize() : mMessageStyle.getOtherTextSize());
    t.setTextColor(isMe ? mMessageStyle.getMyTextColor() : mMessageStyle.getOtherTextColor());
    t.setLinkTextColor(isMe ? mMessageStyle.getMyTextColor() : mMessageStyle.getOtherTextColor());
    t.setTypeface(isMe ? mMessageStyle.getMyTextTypeface() : mMessageStyle.getOtherTextTypeface(), isMe ? mMessageStyle.getMyTextStyle() : mMessageStyle.getOtherTextStyle());
    return new CellHolder(v);
}

98. UnderlabelValidator#replaceView()

View license
private TextView replaceView(ValidationHolder validationHolder) {
    EditText editText = validationHolder.getEditText();
    ViewGroup parent = (ViewGroup) editText.getParent();
    int index = parent.indexOfChild(editText);
    LinearLayout newContainer = new LinearLayout(mContext);
    newContainer.setLayoutParams(editText.getLayoutParams());
    newContainer.setOrientation(LinearLayout.VERTICAL);
    TextView textView = new TextView(mContext);
    textView.setText(validationHolder.getErrMsg());
    textView.setTextColor(mColor);
    textView.setPadding(editText.getPaddingLeft(), 0, editText.getPaddingRight(), 0);
    textView.startAnimation(AnimationUtils.loadAnimation(mContext, android.R.anim.fade_in));
    parent.removeView(editText);
    newContainer.addView(editText);
    newContainer.addView(textView);
    parent.addView(newContainer, index);
    mViewsInfos.add(new ViewsInfo(index, parent, newContainer, editText));
    return textView;
}

99. MainActivity#displayAboutDialog()

View license
private void displayAboutDialog() {
    // REALLY REALLY LAZY LINKIFIED DIALOG
    final int paddingSizeDp = 5;
    final float scale = getResources().getDisplayMetrics().density;
    final int dpAsPixels = (int) (paddingSizeDp * scale + 0.5f);
    final TextView textView = new TextView(this);
    final SpannableString text = new SpannableString(getString(R.string.about_dialog_text));
    textView.setText(text);
    textView.setAutoLinkMask(RESULT_OK);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setPadding(dpAsPixels, dpAsPixels, dpAsPixels, dpAsPixels);
    Linkify.addLinks(text, Linkify.ALL);
    new AlertDialog.Builder(this).setTitle(R.string.menu_about).setCancelable(false).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        public void onClick(final DialogInterface dialog, final int id) {
        }
    }).setView(textView).show();
}

100. TabFragment#onCreateView()

Project: ColorTrackView
Source File: TabFragment.java
View license
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    TextView tv = new TextView(getActivity());
    tv.setTextSize(60);
    Random r = new Random();
    tv.setBackgroundColor(Color.argb(r.nextInt(120), r.nextInt(255), r.nextInt(255), r.nextInt(255)));
    tv.setText(mTitle);
    tv.setGravity(Gravity.CENTER);
    return tv;
}