Example usage for android.widget TextView setTextSize

List of usage examples for android.widget TextView setTextSize

Introduction

In this page you can find the example usage for android.widget TextView setTextSize.

Prototype

@android.view.RemotableViewMethod
public void setTextSize(float size) 

Source Link

Document

Set the default text size to the given value, interpreted as "scaled pixel" units.

Usage

From source file:de.madvertise.android.sdk.MadView.java

private void showTextBannerView() {
    MadUtil.logMessage(null, Log.DEBUG, "Add text banner");
    TextView textView = new TextView(getContext());
    textView.setGravity(Gravity.CENTER);
    textView.setText(currentAd.getText());
    textView.setTextSize(textSize);
    textView.setTextColor(textColor);/* ww w .j  ava  2 s .co  m*/
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    setBackgroundDrawable(textBannerBackground);

    removeAllViews();
    addView(textView);
}

From source file:com.github.vseguip.sweet.contacts.SweetConflictResolveActivity.java

/**
 * @param fieldTable/*from  w  w  w  .j av a2s .c om*/
 * @param nameOfField
 * @param field
 */
private void addConflictRow(TableLayout fieldTable, final String nameOfField, final String fieldLocal,
        final String fieldRemote) {
    if (mCurrentLocal == null || mCurrentSugar == null)
        return;
    // String fieldLocal = mCurrentLocal.get(nameOfField);
    // String fieldRemote = mCurrentSugar.get(nameOfField);
    TableRow row = new TableRow(this);
    final Spinner sourceSelect = new Spinner(this);
    sourceSelect.setBackgroundResource(R.drawable.black_underline);
    ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, this.getResources().getStringArray(R.array.conflict_sources));
    spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    sourceSelect.setAdapter(spinnerArrayAdapter);
    // Open the spinner when pressing any of the text fields
    OnClickListener spinnerOpener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            sourceSelect.performClick();
        }
    };
    row.addView(sourceSelect);
    fieldTable.addView(row);
    row = new TableRow(this);
    TextView fieldName = new TextView(this);
    int stringId = this.getResources().getIdentifier(nameOfField, "string", this.getPackageName());
    fieldName.setText(this.getString(stringId));
    fieldName.setTextSize(16);
    fieldName.setPadding(fieldName.getPaddingLeft(), fieldName.getPaddingTop(),
            fieldName.getPaddingRight() + 10, fieldName.getPaddingBottom());
    fieldName.setOnClickListener(spinnerOpener);
    row.addView(fieldName);
    final TextView fieldValueLocal = new TextView(this);
    fieldValueLocal.setText(fieldLocal);
    fieldValueLocal.setTextSize(16);
    row.addView(fieldValueLocal);
    fieldValueLocal.setOnClickListener(spinnerOpener);

    fieldTable.addView(row);
    row = new TableRow(this);
    row.addView(new TextView(this));// add dummy control
    final TextView fieldValueRemote = new TextView(this);
    fieldValueRemote.setText(fieldRemote);
    fieldValueRemote.setTextSize(16);

    fieldValueRemote.setOnClickListener(spinnerOpener);
    row.addView(fieldValueRemote);
    sourceSelect.setOnItemSelectedListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (position == 0) {
                fieldValueLocal.setTextAppearance(SweetConflictResolveActivity.this, R.style.textSelected);
                fieldValueRemote.setTextAppearance(SweetConflictResolveActivity.this, R.style.textUnselected);
                resolvedContacts[mPosResolved].set(nameOfField, fieldLocal);
            } else {
                fieldValueLocal.setTextAppearance(SweetConflictResolveActivity.this, R.style.textUnselected);
                fieldValueRemote.setTextAppearance(SweetConflictResolveActivity.this, R.style.textSelected);
                resolvedContacts[mPosResolved].set(nameOfField, fieldRemote);
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> view) {
        }
    });
    row.setPadding(row.getLeft(), row.getTop() + 5, row.getRight(), row.getBottom() + 10);
    // Restore appropiate selections according to resolved contact
    if (resolvedContacts[mPosResolved].get(nameOfField).equals(fieldLocal)) {
        sourceSelect.setSelection(0);
    } else {
        sourceSelect.setSelection(1);
    }
    fieldTable.addView(row);
}

From source file:com.jgraves.achievementunlocked.AchievementsList_Fragment.java

private void addAchievementToList(Long id, String name, int points) {
    Log.i(ExploraApp.TAG, "Adding achievement image request of id " + id + " with height, " + imageViewHeight);
    FrameLayout fl = new FrameLayout(getActivity());
    touchMap.put(fl, id);//from ww w .j a v a2  s.  c  om
    fl.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Long id = touchMap.get(v);
            Log.i(ExploraApp.TAG, "TOUCHED " + id);
            Intent intent = new Intent(getActivity(), Activity_AchievementInfo.class);
            intent.putExtra("achievement_id", Long.toString(id));
            startActivity(intent);
        }
    });
    TextView tv_name = new TextView(getActivity());
    TextView tv_points = new TextView(getActivity());
    ImageView iv = new ImageView(getActivity());
    fl.setMinimumHeight(imageViewHeight);
    fl.setMinimumWidth(ExploraApp.screenWidth);
    robotoTypeface = Typeface.createFromAsset(getActivity().getAssets(), "Roboto-Thin.ttf");
    tv_name.setText(name);
    tv_name.setTextSize(15f);
    tv_points.setTextSize(15f);
    tv_name.setTypeface(robotoTypeface);
    tv_points.setTypeface(robotoTypeface);
    tv_points.setText(Integer.toString(points));
    tv_points.setGravity(Gravity.RIGHT);
    tv_points.setTextColor(Color.WHITE);
    tv_name.setTextColor(Color.WHITE);
    iv.setMinimumHeight(imageViewHeight);
    iv.setMinimumWidth(ExploraApp.screenWidth);
    fl.addView(iv);
    fl.addView(tv_name);
    fl.addView(tv_points);
    ll_images_container.addView(fl);
    sv_images.bringChildToFront(mQuickReturnView);
    DefaultImageListener listener = new DefaultImageListener(iv);
    ImageRequest imageRequest = new ImageRequest(
            ExploraApp.url_main + "/achievement/" + id + "/photo?y=" + imageViewHeight + "&x="
                    + ExploraApp.screenWidth,
            listener, ExploraApp.screenWidth, imageViewHeight, Bitmap.Config.ARGB_8888, listener);
    ExploraApp.mRequestQueue.add(imageRequest);
}

From source file:com.gsbabil.antitaintdroid.UtilityFunctions.java

public int captureBitmapCache(String in) {
    TextView tv = (TextView) MyApp.context.findViewById(R.id.ocrTextview);
    String tvText = tv.getText().toString();
    float tvTextSize = tv.getTextSize();
    int tvColor = tv.getCurrentTextColor();
    Bitmap bitmap = null;//from   ww  w  . jav a 2  s.co m

    tv.setTextSize(36);
    tv.setTextColor(Color.CYAN);
    tv.setTypeface(Typeface.SANS_SERIF);

    tv.setText(in);

    while (bitmap == null) {
        // http://stackoverflow.com/questions/2339429/android-view-getdrawingcache-returns-null-only-null
        tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        tv.layout(0, 0, tv.getMeasuredWidth(), tv.getMeasuredHeight());

        tv.setDrawingCacheEnabled(true);
        tv.buildDrawingCache(true);
        bitmap = Bitmap.createBitmap(tv.getDrawingCache());
        tv.destroyDrawingCache();
        tv.setDrawingCacheEnabled(false);
    }

    FileOutputStream fos = null;
    int res = -1;
    try {
        fos = new FileOutputStream(currentDirectory() + "/files/" + MyApp.SCREENSHOT_FILENAME);
        if (fos != null) {
            bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos);
            fos.close();
            res = 0;
        }
    } catch (Throwable e) {
        Log.i(MyApp.TAG, e.getMessage().toString());
        res = -1;
    }

    tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, tvTextSize);
    tv.setTypeface(Typeface.MONOSPACE);
    tv.setText(tvText);
    tv.setTextColor(tvColor);
    return res;
}

From source file:com.cssweb.android.base.QuoteGridActivity.java

protected void initQuote(int pageNum, String stocks, String stocksname) throws JSONException {
    String[] temp1 = stocks.split(",");
    String[] temp2 = stocksname.split(",");
    try {/*from w  w w  . ja v a 2  s . c om*/
        TextView localView = (TextView) this.mLinerLock.getChildAt(0);
        if (nameOrcode) {
            localView.setText(zqname);
        } else {
            localView.setText(zqcode);
        }

        for (int i = 1; i <= pageNum; i++) {
            TextView localView6 = (TextView) this.mLinerLock.findViewWithTag(i);
            if (nameOrcode) {
                localView6.setTextSize(13);
                localView6.setText(temp2[i - 1]);
            } else {
                localView6.setTextSize(18);
                localView6.setText(temp1[i - 1].substring(2));
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.TakeTaxi.jy.OnrouteScreen.java

public void pingpicked(JSONObject json) {

    try {/*from  www .j  a v a 2 s . c o m*/

        int driverpicked = json.getInt("picked");
        int drivercancelled = json.getInt("dcancel");
        int starttime = json.getInt("datetime");

        // /////////////////////////////// DRIVER CANCEL ////////
        if (drivercancelled == 1) {

            // //// DRIVER CANCEL LATE /////

            if (starttime + 300 <= Query.getServerTime()) {
                handlerboolean = false;
                handler.removeCallbacks(r);

                AlertDialog dcancelbuilder = new AlertDialog.Builder(OnrouteScreen.this).create();
                dcancelbuilder
                        .setMessage("Job has been cancelled.\nWould you like to report a late cancellation?.");

                // //// DRIVER CANCEL LATE - NO REPORT LATE/////
                button_cancelJob_noquery(dcancelbuilder);
                // //// DRIVER CANCEL LATE - REPORT LATE /////
                button_drivercancel_reportlate(dcancelbuilder);

                dcancelbuilder.show();

            } else {
                // /////////////////////////////// DRIVER CANCEL NO ALERTS -
                // WITHIN TIME LIMIT///////////////
                handlerboolean = false;
                handler.removeCallbacks(r);

                alertdialog_drivercancelintime();

            }
        }
        if (driverpicked == 1) {
            // /////////////////////////////// CONFIRM PICK UP
            // ///////////////////////////////////////////

            handlerboolean = false;
            handler.removeCallbacks(r);
            AlertDialog.Builder alert = new AlertDialog.Builder(OnrouteScreen.this);
            final Drawable thumbsup = getResources().getDrawable(R.drawable.thumbsup);
            final Drawable thumbsupwhite = getResources().getDrawable(R.drawable.thumbsupwhite);
            final Drawable thumbsdown = getResources().getDrawable(R.drawable.thumbsdown);
            final Drawable thumbsdownwhite = getResources().getDrawable(R.drawable.thumbsdownwhite);
            LinearLayout layout = new LinearLayout(OnrouteScreen.this);
            layout.setOrientation(1);
            layout.setGravity(17);

            TextView tx1 = new TextView(OnrouteScreen.this);
            tx1.setText("Driver says you have been picked up");
            tx1.setGravity(17);
            tx1.setTextSize(20);
            tx1.setTextColor(Color.WHITE);
            tx1.setPadding(10, 10, 10, 10);

            TextView tx2 = new TextView(OnrouteScreen.this);
            tx2.setText("Please rate your driver");
            tx2.setGravity(17);
            tx2.setTextSize(16);

            LinearLayout imglayout = new LinearLayout(OnrouteScreen.this);
            imglayout.setOrientation(0);
            imglayout.setGravity(17);

            final ImageView ivup = new ImageView(OnrouteScreen.this);
            ivup.setImageDrawable(thumbsupwhite);
            ivup.setClickable(true);
            ivup.setPadding(0, 5, 30, 5);
            final ImageView ivdown = new ImageView(OnrouteScreen.this);
            ivdown.setImageDrawable(thumbsdownwhite);
            ivdown.setClickable(true);
            ivup.setPadding(30, 5, 0, 5);
            imglayout.addView(ivup);
            imglayout.addView(ivdown);

            layout.addView(tx1);
            layout.addView(tx2);

            layout.addView(imglayout);
            // /////////////////////////////// CONFIRM PICK UP - RATINGS
            // ///////////////////////////////////////////

            ivup.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    if (thumbsupboolean == false) {
                        thumbsupboolean = true;
                        thumbsdownboolean = false;
                        ivup.setImageDrawable(thumbsup);
                        ivdown.setImageDrawable(thumbsdownwhite);
                        rating = 1;
                    } else {
                        thumbsupboolean = false;
                        ivup.setImageDrawable(thumbsupwhite);
                        rating = 0;
                    }

                }
            });

            ivdown.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    if (thumbsdownboolean == false) {
                        thumbsdownboolean = true;
                        thumbsupboolean = false;
                        ivdown.setImageDrawable(thumbsdown);
                        ivup.setImageDrawable(thumbsupwhite);

                        AlertDialog alert = new AlertDialog.Builder(OnrouteScreen.this).create();

                        alert.setMessage("Please pick one");
                        alert.setButton("No show", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -1;
                            }
                        });
                        alert.setButton2("Driver late", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -2;
                            }
                        });
                        alert.setButton3("Poor service", new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int which) {
                                rating = -3;
                            }
                        });
                        alert.show();

                    } else {
                        thumbsupboolean = false;
                        ivdown.setImageDrawable(thumbsdownwhite);
                        rating = 0;
                    }

                }
            });

            button_completed_finish(alert);

            alert.setView(layout);
            alert.create();
            alert.show();
        } else {
        }

    } catch (JSONException e) {
    }
}

From source file:samsungsami.io.example.samiremotecontrol.DeviceActivity.java

/**
 * Fill the device status and info table
 *///from w  w w. j av  a 2 s.  c  o m
void fillTable() {

    TableRow row;
    TextView t1, t2, t3;
    for (int current = 0; current < fields.size(); current++) {
        row = new TableRow(this);
        t1 = new TextView(this);
        t1.setTextColor(Color.GRAY);
        t2 = new TextView(this);
        t2.setTextColor(Color.BLACK);
        t3 = new TextView(this);
        t3.setTextColor(Color.BLACK);

        t1.setText(fields.get(current));
        t2.setText(values.get(current));
        t3.setText(units.get(current));

        t1.setTextSize(15);
        t2.setTextSize(15);
        t3.setTextSize(15);

        row.addView(t1);

        if (fields.get(current).equals("state")) {
            Switch toggle = new Switch(this);
            toggle.setChecked(values.get(current).toLowerCase().equals("on"));
            toggle.setEnabled(false);
            row.addView(toggle);
        } else
            row.addView(t2);

        row.addView(t3);
        propertiesTableLayout.addView(row, new TableLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        // Adjust the view
        propertiesTableLayout.setColumnStretchable(0, true);
        propertiesTableLayout.setColumnStretchable(1, true);
        propertiesTableLayout.setColumnStretchable(2, true);
    }
}

From source file:com.umeng.message.example.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    pushDao = PushDao.getInstance(this);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    screenWidth = dm.widthPixels;/*www . ja va  2s  .c  o m*/

    setContentView(R.layout.activity_main);

    printKeyValue();

    mPushAgent = PushAgent.getInstance(this);
    mPushAgent.onAppStart();
    mPushAgent.enable(MyApplication.mRegisterCallback);

    tvStatus = (TextView) findViewById(R.id.tvStatus);
    btnEnable = (ImageView) findViewById(R.id.btnEnable);
    btnaAddTag = (Button) findViewById(R.id.btnAddTags);
    btnAddAlias = (Button) findViewById(R.id.btnAddAlias);
    btnListTag = (Button) findViewById(R.id.btnListTags);
    infoTextView = (TextView) findViewById(R.id.info);
    edTag = (EditText) findViewById(R.id.edTag);
    edAlias = (EditText) findViewById(R.id.edAlias);
    edAliasType = (EditText) findViewById(R.id.edAliasType);
    spAliasType = (Spinner) findViewById(R.id.spAliasType);

    edAliasType.setOnFocusChangeListener(new android.view.View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                edAliasTypeFocus = true;
            } else {
                edAliasTypeFocus = false;
            }
        }

    });

    edAliasType.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub
            if (edAliasTypeFocus) {
                spAliasType.setSelection(0);
            }
        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }

    });

    String[] aliasType = new String[] { "Alias Type:", ALIAS_TYPE.SINA_WEIBO, ALIAS_TYPE.BAIDU,
            ALIAS_TYPE.KAIXIN, ALIAS_TYPE.QQ, ALIAS_TYPE.RENREN, ALIAS_TYPE.TENCENT_WEIBO, ALIAS_TYPE.WEIXIN };
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_single_choice, aliasType);
    spAliasType.setAdapter(adapter);
    spAliasType.setBackgroundColor(Color.LTGRAY);
    spAliasType.setOnItemSelectedListener(new OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            // TODO Auto-generated method stub
            TextView tv = (TextView) arg1;
            if (tv != null) {
                int rate = (int) (5.0f * (float) screenWidth / 320.0f);
                int textSize = rate < 15 ? 15 : rate;
                tv.setTextSize((float) textSize);
            }

            if (arg2 != 0) {
                String type = (String) spAliasType.getItemAtPosition(arg2);
                edAliasType.setText(type);
            } else if (!edAliasTypeFocus) {
                edAliasType.setText("");
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

        }

    });

    tvStatus.setOnClickListener(clickListener);
    btnEnable.setOnClickListener(clickListener);
    btnaAddTag.setOnClickListener(clickListener);
    btnListTag.setOnClickListener(clickListener);
    btnAddAlias.setOnClickListener(clickListener);

    updateStatus();
    mPushAgent.setPushIntentServiceClass(MyPushIntentService.class);

    callbackReceiver = new CallbackReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(MyApplication.CALLBACK_RECEIVER_ACTION);
    registerReceiver(callbackReceiver, filter);
}

From source file:com.cssweb.android.base.QuoteGridActivity.java

private void AddViewItem(String paramString, int paramInt1, LinearLayout paramLinearLayout, int paramInt2,
        int paramInt3, int paramInt4, boolean paramBoolean) {
    TextView localTextView = new TextView(this);
    float f = this.mFontSize;

    localTextView.setTextSize(f);
    //??4?//from   www. j a  va2 s  . c  o  m
    if (paramInt2 == paramInt4 && paramInt3 == 0 && nameOrcode) {

        if (this.mPaint.measureText(paramString) > textWeight)
            localTextView.setTextSize(13);
    }

    if (n2 == paramInt2) {
        String str = (n1 == 0) ? paramString + low : (n1 == 1) ? paramString + top : paramString;
        localTextView.setText(str);
    } else {
        localTextView.setText(paramString);
    }
    localTextView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    localTextView.setFocusable(paramBoolean);
    localTextView.setOnClickListener(mClickListener);
    localTextView.setOnLongClickListener(mLongClickListener);
    localTextView.setOnTouchListener(this); //touch
    localTextView.setTag(paramInt2);
    localTextView.setEnabled(paramBoolean);
    localTextView.setSingleLine(false);
    if (paramInt4 == 0 && paramInt3 >= 0) {//
        localTextView.setGravity(Gravity.CENTER);
        int i1 = this.residTitleCol;
        int i8 = 0;
        localTextView.setTextColor(paramInt1);
        if (paramInt3 == 0) {
            localDrawable = getResources().getDrawable(i1);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 100) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[2]);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 13) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 20;
        } else if (paramInt3 == 8) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 10;
        } else if (paramInt3 % 2 == 0) {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[1]);
            i8 = localDrawable.getIntrinsicWidth();
        } else {
            localDrawable = getResources().getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();
        }
        localTextView.setBackgroundDrawable(localDrawable);
        int i6 = localDrawable.getIntrinsicHeight();
        localTextView.setHeight(i6 + CssSystem.getTableTitleHeight(this));
        //int i9 = (int) Math.max(i8, mPaint.measureText(paramString));
        localTextView.setWidth(i8);
        paramLinearLayout.addView(localTextView);
        return;
    }
    if (paramInt4 != 0 && paramInt3 >= 0) {
        int i8 = 0;
        localTextView.setTextColor(paramInt1);
        if (paramInt3 == 0) {
            localDrawable = getResources().getDrawable(this.residCol);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 100) {
            localDrawable = getResources().getDrawable(this.residScrollCol[2]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 13) {
            localDrawable = getResources().getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 20;
            //localTextView.setWidth(i8+20);
        } else if (paramInt3 == 8) {
            localDrawable = getResources().getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 10;
            //localTextView.setWidth(i8+20);
        } else if (paramInt3 % 2 == 0) {
            localDrawable = getResources().getDrawable(this.residScrollCol[1]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        } else {
            localDrawable = getResources().getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        }
        localTextView.setBackgroundDrawable(localDrawable);
        int i6 = localDrawable.getIntrinsicHeight();
        localTextView.setHeight(i6 + rowHeight);
        //int i9 = (int) Math.max(i8, mPaint.measureText(paramString));
        localTextView.setWidth(i8);
        paramLinearLayout.addView(localTextView);
        return;
    }
    //      if ((paramInt3 == j) && (paramInt4 == l)) {
    //         int i13 = this.residTitleScrollCol[l];
    //         localDrawable = localResources.getDrawable(i13);
    //         localTextView.setTextColor(paramInt1);
    //         localTextView.setBackgroundDrawable(localDrawable);
    //         paramLinearLayout.addView(localTextView);
    //         return;
    //      }
}

From source file:com.juick.android.JuickMessagesAdapter.java

public static float getLineHeight(Context context, double scale) {
    Integer integer = lineHeights.get(scale);
    if (integer == null) {
        TextView textView = new TextView(context);
        textView.setTextSize((int) (getDefaultTextSize(context) * scale));
        integer = textView.getLineHeight();
        lineHeights.put(scale, integer);
    }/*from w  ww.  j  a  va2  s.com*/
    return integer;
}