Example usage for android.util TypedValue COMPLEX_UNIT_PX

List of usage examples for android.util TypedValue COMPLEX_UNIT_PX

Introduction

In this page you can find the example usage for android.util TypedValue COMPLEX_UNIT_PX.

Prototype

int COMPLEX_UNIT_PX

To view the source code for android.util TypedValue COMPLEX_UNIT_PX.

Click Source Link

Document

#TYPE_DIMENSION complex unit: Value is raw pixels.

Usage

From source file:com.android.contacts.list.ContactListItemView.java

/**
 * Returns the text view for the contact name, creating it if necessary.
 *//*from  w  w w  .j av a2 s.c o  m*/
public TextView getNameTextView() {
    if (mNameTextView == null) {
        mNameTextView = new TextView(getContext());
        mNameTextView.setSingleLine(true);
        mNameTextView.setEllipsize(getTextEllipsis());
        mNameTextView.setTextColor(ResourcesCompat.getColorStateList(getResources(),
                R.color.contact_list_name_text_color, getContext().getTheme()));
        mNameTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNameTextViewTextSize);
        // Manually call setActivated() since this view may be added after the first
        // setActivated() call toward this whole item view.
        mNameTextView.setActivated(isActivated());
        mNameTextView.setGravity(Gravity.CENTER_VERTICAL);
        mNameTextView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
        mNameTextView.setId(R.id.cliv_name_textview);
        if (CompatUtils.isLollipopCompatible()) {
            mNameTextView.setElegantTextHeight(false);
        }
        addView(mNameTextView);
    }
    return mNameTextView;
}

From source file:org.de.jmg.learn.SettingsActivity.java

private void resize(float scale) {
    //if (scale == 0 && mScale!=1) return;
    Resources resources = _main.getResources();
    DisplayMetrics metrics = resources.getDisplayMetrics();
    @SuppressWarnings("unused")
    int Density = metrics.densityDpi;
    try {/*from w w  w .j  a v a  2 s .co m*/
        int width = mainView.getWidth();
        if (width > 500) {
            width -= lib.dpToPx(40);
        } else {
            width -= lib.dpToPx(40);
        }
        if (scale == 0) {
            mainView.setVisibility(View.INVISIBLE);
            libLearn.gStatus = "Calculating Scale";

            float scale1 = width / (float) (_main.isSmallDevice ? 0
                    : (findViewById(R.id.txtCharsetASCII)).getWidth() + spnASCII.getWidth() + width / 30);
            float scale2 = width / (float) (_main.isSmallDevice ? 0
                    : (findViewById(R.id.txtSounds)).getWidth() + spnSounds.getWidth() + width / 30);
            float scale3 = width / (float) (_main.isSmallDevice ? 0
                    : (findViewById(R.id.txtCharsetASCII)).getWidth() + spnASCII.getWidth() + width / 30);
            scale = (scale1 < scale2) ? scale1 : scale2;
            scale = (scale3 < scale) ? scale3 : scale;
        }
        mScale = scale;

        ViewGroup Settings = (ViewGroup) findViewById(R.id.layoutSettings);
        libLearn.gStatus = "Enumerating ChildViews";
        int ChildCount = Settings.getChildCount();
        for (int i = 0; i < ChildCount; i++) {
            if (i > 100)
                break;
            libLearn.gStatus = "getting view " + i;
            View V = Settings.getChildAt(i);
            /*
            CharSequence cs = V.getContentDescription();
            if (cs != null && cs.length()>0 )
            {
               V.setOnLongClickListener(ViewOnLongClickCD);
            }
            */
            RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) V
                    .getLayoutParams();

            params.topMargin = (int) (params.topMargin * scale);
            params.bottomMargin = (int) (params.bottomMargin * scale);

            if (params.height > 0)
                params.height = (int) (params.height * scale);
            if (V instanceof CheckBox) {
                if (params.width > 0)
                    params.width = ((width - lib.dpToPx(10)) / 3);
            } else {
                if (params.width > 0)
                    params.width = (int) (params.width * scale);
            }
            /*
            if (V == spnSounds) {
               int soundsHeight = spnSounds.getHeight();
               float margin = (float) ((soundsHeight * scale) / 5.25);
               params.topMargin = params.topMargin + (int) margin;
            }
            */
            libLearn.gStatus = "Setting Layoutparams";
            V.setLayoutParams(params);
            // }
            if (V instanceof TextView && !(V instanceof CheckBox)) {
                libLearn.gStatus = "TextView set size";
                TextView t = (TextView) V;
                t.setTextSize(TypedValue.COMPLEX_UNIT_PX, t.getTextSize() * scale);
            } else if (V instanceof Spinner) {
                Spinner spn = (Spinner) V;
                SpinnerAdapter A = spn.getAdapter();
                if (A instanceof AbstractScaledArrayAdapter<?>) {
                    libLearn.gStatus = "Scaling Adapter";
                    AbstractScaledArrayAdapter<?> AA = (AbstractScaledArrayAdapter<?>) A;
                    AA.Scale = AA.Scale * scale;
                    if (spn.getSelectedItemPosition() > -1) {
                        AA.notifyDataSetChanged();
                    }

                }
            } else if (V instanceof CheckBox) {
                libLearn.gStatus = "CheckBox";
                CheckBox c = (CheckBox) V;
                //c.setScaleX(scale);
                //c.setScaleY(scale);
                // c.setle
                c.setTextSize(TypedValue.COMPLEX_UNIT_PX, c.getTextSize() * scale);

                /*
                int p1 = c.getPaddingTop();
                int p2 = c.getPaddingBottom();
                int p3 = c.getPaddingLeft();
                int p4 = c.getPaddingRight();
                c.setPadding((int) (p3/scale), p1, p4, p2);
                */
                //LevelListDrawable D = (LevelListDrawable) c.getBackground();
                /*
                Drawable d = c.getBackground();
                Log.d("bounds", d.getBounds().toString());
                */
                //d.setTargetDensity((int) (Density * scale));
                //d.setBounds(0, 0, c.getHeight(), c.getHeight());
                //lib.setBgCheckBox(c,d);
                /*
                ViewGroup check = (ViewGroup) V;
                for (int ii = 0; ii<check.getChildCount(); ii++)
                {
                   View cv = check.getChildAt(ii);
                   String cls = cv.getClass().getName();
                   Log.d("Classs", cls);
                }
                */
                // Drawable d = lib.getDefaultCheckBoxDrawable(_main);
                // d = new ScaleDrawable(d, 0, c.getHeight()*scale,
                // c.getHeight()*scale).getDrawable();
                // float scaleC = (float)c.getHeight()/d.getBounds().height();
                // d.setBounds(0, 0,(int) (c.getHeight()*scale),(int)
                // (c.getHeight()*scale));
                // LayerDrawable L = new LayerDrawable(new Drawable[]{d});
                // d = lib.scaleImage(_main, d, scaleC);
                // /c.setButtonDrawable(d);
            }
        }
        /*
        libLearn.gStatus="Buttons";
        Button b = (Button) findViewById(R.id.btnOK);
        RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) b
              .getLayoutParams();
        params.topMargin = (int) (params.topMargin * scale);
        if (params.height>0)params.height = (int) (params.height * scale);
        if (params.width>0)params.width = (int) (params.width * scale);
        b.setLayoutParams(params);
        b.setTextSize(TypedValue.COMPLEX_UNIT_PX, b.getTextSize() * scale);
                
        b = (Button) findViewById(R.id.btnCancel);
        params = (android.widget.RelativeLayout.LayoutParams) b
              .getLayoutParams();
        params.topMargin = (int) (params.topMargin * scale);
        if (params.height>0)params.height = (int) (params.height * scale);
        if (params.width>0)params.width = (int) (params.width * scale);
        b.setLayoutParams(params);
        b.setTextSize(TypedValue.COMPLEX_UNIT_PX, b.getTextSize() * scale);
        */
        SettingsView.getViewTreeObserver()
                .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

                    @Override
                    public void onGlobalLayout() {
                        // Ensure you call it only once :
                        lib.removeLayoutListener(SettingsView.getViewTreeObserver(), this);
                        int pos = spnASCII.getSelectedItemPosition();
                        spnASCII.setSelection(-1);
                        spnASCII.setSelection(pos);
                    }
                });

    } catch (Exception ex) {
        lib.ShowException(_main, ex);
    } finally {
        mainView.setVisibility(View.VISIBLE);
    }

}

From source file:com.tct.mail.browse.ConversationItemView.java

private void layoutParticipantText(SpannableStringBuilder participantText) {
    if (participantText != null) {
        if (isActivated() && showActivatedText()) {
            participantText.setSpan(sActivatedTextSpan, 0, mHeader.styledMessageInfoStringOffset,
                    Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        } else {// ww  w .  jav a2s.c om
            participantText.removeSpan(sActivatedTextSpan);
        }

        //TS: yanhua.chen 2015-9-2 EMAIL CR_540046 MOD_S
        //Note sender width should use define in xml
        final int w = mCoordinates.sendersWidth;
        //TS: yanhua.chen 2015-9-2 EMAIL CR_540046 MOD_E
        final int h = mCoordinates.sendersHeight;
        mSendersTextView.setLayoutParams(new ViewGroup.LayoutParams(w, h));
        mSendersTextView.setMaxLines(mCoordinates.sendersLineCount);
        mSendersTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mCoordinates.sendersFontSize);
        layoutViewExactly(mSendersTextView, w, h);

        /// TCT: add for search term highlight @{
        boolean hasFilter = (mSearchParams != null && !TextUtils.isEmpty(mSearchParams.mFilter));
        boolean fieldMatched = (mSearchParams != null
                && (SearchParams.SEARCH_FIELD_FROM.equals(mSearchParams.mField)
                        || SearchParams.SEARCH_FIELD_ALL.equals(mSearchParams.mField)
                        || SearchParams.SEARCH_FIELD_TO.equals(mSearchParams.mField))); //porting from PR937141
        if (hasFilter && fieldMatched) {
            CharacterStyle[] spans = participantText.getSpans(0, participantText.length(),
                    CharacterStyle.class);
            String senderToHightlight = participantText.toString();
            CharSequence highlightedSender = TextUtilities.highlightTermsInText(senderToHightlight,
                    mSearchParams.mFilter);
            highlightedSender = copyStyles(spans, highlightedSender);
            mSendersTextView.setText(highlightedSender);
        } else {
            mSendersTextView.setText(participantText);
        }
        /// @}
    }
}

From source file:com.tct.mail.browse.ConversationItemView.java

private void createSubject(final boolean isUnread) {
    final String badgeText = mHeader.badgeText == null ? "" : mHeader.badgeText;
    String subject = filterTag(getContext(), mHeader.conversation.subject);
    subject = Conversation.getSubjectForDisplay(mContext, badgeText, subject);

    /// TCT: add for search term highlight
    // process subject and snippet respectively @{
    SpannableStringBuilder subjectToHighlight = new SpannableStringBuilder(subject);
    boolean hasFilter = (mSearchParams != null && !TextUtils.isEmpty(mSearchParams.mFilter));
    if (hasFilter) {
        boolean fieldMatchedSubject = (mSearchParams != null
                && (SearchParams.SEARCH_FIELD_SUBJECT.equals(mSearchParams.mField)
                        || SearchParams.SEARCH_FIELD_ALL.equals(mSearchParams.mField)));
        /// TCT: Only highlight un-empty subject
        if (fieldMatchedSubject && !TextUtils.isEmpty(subject)) {
            CharSequence subjectChars = TextUtilities.highlightTermsInText(subject, mSearchParams.mFilter);
            subjectToHighlight.replace(0, subject.length(), subjectChars);
        }/*from  w w  w.j  av  a 2s  .com*/
    }
    /// @}
    final Spannable displayedStringBuilder = new SpannableString(subjectToHighlight);

    // since spans affect text metrics, add spans to the string before measure/layout or fancy
    // ellipsizing

    final int badgeTextLength = formatBadgeText(displayedStringBuilder, badgeText);

    if (!TextUtils.isEmpty(subject)) {
        displayedStringBuilder.setSpan(
                TextAppearanceSpan.wrap(isUnread ? sSubjectTextUnreadSpan : sSubjectTextReadSpan),
                badgeTextLength, subject.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    if (isActivated() && showActivatedText()) {
        displayedStringBuilder.setSpan(sActivatedTextSpan, badgeTextLength, displayedStringBuilder.length(),
                Spannable.SPAN_INCLUSIVE_INCLUSIVE);
    }

    final int subjectWidth = mSubjectWidth;//TS: yanhua.chen 2015-9-2 EMAIL CR_540046 MOD
    final int subjectHeight = mCoordinates.subjectHeight;
    mSubjectTextView.setLayoutParams(new ViewGroup.LayoutParams(subjectWidth, subjectHeight));
    mSubjectTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mCoordinates.subjectFontSize);
    layoutViewExactly(mSubjectTextView, subjectWidth, subjectHeight);

    //[FEATURE]-Mod-BEGIN by CDTS.zhonghua.tuo,05/29/2014,FR 670064
    SpannableStringBuilder builder = new SpannableStringBuilder();
    boolean filterSubject = false;
    if (mField == UIProvider.LOCAL_SEARCH_ALL || mField == UIProvider.LOCAL_SEARCH_SUBJECT) {
        filterSubject = true;
    }
    if (mQueryText != null && filterSubject) {
        CharSequence formatSubject = displayedStringBuilder;
        formatSubject = TextUtilities.highlightTermsInText(subject, mQueryText);
        builder.append(formatSubject);
        mSubjectTextView.setText(builder);
        // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_S
        //store the displayed subject for calculate the statusView's X and width
        mHeader.subjectText = builder.toString();
        // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_E
    } else {
        mSubjectTextView.setText(displayedStringBuilder);
        // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_S
        mHeader.subjectText = displayedStringBuilder.toString();
        // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_E
    }
    //[FEATURE]-Mod-END by CDTS.zhonghua.tuo
}

From source file:org.de.jmg.learn._MainActivity.java

void StartEdit() throws Exception {
    _txtWord.setText(lib.getSpanableString(_vok.getWort()), TextView.BufferType.SPANNABLE);
    _txtWord.setVisibility(View.GONE);
    _txtKom.setVisibility(View.GONE);
    _txtedWord.setVisibility(View.VISIBLE);
    _txtedWord.setText(_txtWord.getText());
    /*// www .j  av a2 s . co  m
    if (_vok.getSprache() == EnumSprachen.Hebrew)
    {
       try
       {
    lib.setLocale(context, "he");
       }
       catch (Exception ex)
       {
    try
    {
       lib.setLocale(context, "iw");
    }
    catch (Exception eex)
    {
       lib.ShowException(_main,eex);
    }
       }
    }
    */
    _txtedWord.setTextSize(TypedValue.COMPLEX_UNIT_PX, _txtWord.getTextSize());
    View LayWord = findViewById(R.id.LayWord);
    assert LayWord != null;
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) LayWord.getLayoutParams();
    params.width = LayoutParams.MATCH_PARENT;
    LayWord.setLayoutParams(params);
    _txtedKom.setVisibility(View.VISIBLE);
    _txtedKom.setText(_vok.getKommentar());
    _txtedKom.setTextSize(TypedValue.COMPLEX_UNIT_PX, _txtKom.getTextSize());
    _txtedWord.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    _txtedKom.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    _txtedWord.setSingleLine(false);
    _txtedWord.setMaxLines(3);
    _txtedKom.setSingleLine(false);
    _txtedKom.setMaxLines(3);
    if (!_vok.getCardMode()) {
        _txtMeaning1.setImeOptions(EditorInfo.IME_ACTION_NEXT);
        _txtMeaning2.setVisibility(View.VISIBLE);
        _txtMeaning2.setImeOptions(EditorInfo.IME_ACTION_NEXT);
        _txtMeaning3.setVisibility(View.VISIBLE);
        _txtMeaning3.setImeOptions(EditorInfo.IME_ACTION_DONE);
        _txtMeaning2.setText(_vok.getBedeutung2());
        _txtMeaning3.setText(_vok.getBedeutung3());
        lib.setBgEditText(_txtMeaning1, _MeaningBG);
        lib.setBgEditText(_txtMeaning2, _MeaningBG);
        lib.setBgEditText(_txtMeaning3, _MeaningBG);
        _txtMeaning1.setLines(1);
        _txtMeaning1.setSingleLine();
        _txtMeaning2.setLines(1);
        _txtMeaning2.setSingleLine();
        _txtMeaning3.setLines(1);
        _txtMeaning3.setSingleLine();

    } else {
        lib.setBgEditText(_txtMeaning1, _MeaningBG);
        _txtMeaning1.setImeOptions(EditorInfo.IME_ACTION_DONE);
        //_originalMovementmethod = _txtMeaning1.getMovementMethod();
        //_txtMeaning1.setAutoLinkMask(0);
        if (_originalMovementmethod != null
                && _txtMeaning1.getMovementMethod() == LinkMovementMethod.getInstance()) {
            _txtMeaning1.setMovementMethod(_originalMovementmethod);
        }
        //_txtMeaning1.requestFocus();
        //InputMethodManager Imn = (InputMethodManager) _main.getSystemService(Context.INPUT_METHOD_SERVICE);
        //Imn.showSoftInputFromInputMethod(_txtMeaning1.getWindowToken(), 0);
    }
    //_txtMeaning1.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    _txtMeaning1.setText(_vok.getBedeutung1());
    setBtnsEnabled(false);
    _btnEdit.setEnabled(true);
    _txtMeaning1.clearFocus();
    _txtedWord.clearFocus();
    //_txtedWord.requestFocusFromTouch();
    _txtedWord.requestFocus();
    mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            lib.removeLayoutListener(mainView.getViewTreeObserver(), this);
            _txtedWord.requestFocus();
        }
    });
}

From source file:com.tct.mail.browse.ConversationItemView.java

private void createStatus() {
    final String display = mHeader.conversation.getStatusForDisplay(mContext);
    final int statusWidth = mStatusWidth;
    final int statusHeight = mCoordinates.statusHeight;
    final int status = mHeader.conversation.getStatus();
    if (status == EmailContent.Message.MAIL_IN_FAILED_STATUS) {
        mStatusTextView.setTextColor(getResources().getColor(android.R.color.holo_red_dark));
    } else {//from www. ja v  a 2  s .  co  m
        mStatusTextView.setTextColor(getResources().getColor(R.color.status_text_color));
    }
    mStatusTextView.setText(display);
    mStatusTextView.setLayoutParams(new ViewGroup.LayoutParams(statusWidth, statusHeight));
    mStatusTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mCoordinates.subjectFontSize);
    layoutViewExactly(mStatusTextView, statusWidth, statusHeight);
    //TS: jian.xu 2015-11-27 EMAIL BUGFIX-980186 ADD_S
    //Note: Update conversation sending status in conversation selected set.
    if (mSelectedConversationSet != null) {
        mSelectedConversationSet.updateSendingStatus(mHeader.conversation);
    }
    //TS: jian.xu 2015-11-27 EMAIL BUGFIX-980186 ADD_E
}

From source file:com.tct.mail.browse.ConversationItemView.java

private void createSnippet() {
    final String snippet = mHeader.conversation.getSnippet();
    /// TCT: add for search term highlight
    // process subject and snippet respectively @{
    SpannableStringBuilder snippetToHighlight = new SpannableStringBuilder(snippet);
    boolean hasFilter = (mSearchParams != null && !TextUtils.isEmpty(mSearchParams.mFilter));
    if (hasFilter) {
        boolean fieldMatchedSnippet = (mSearchParams != null
                && (SearchParams.SEARCH_FIELD_BODY.equals(mSearchParams.mField)
                        || SearchParams.SEARCH_FIELD_ALL.equals(mSearchParams.mField)));

        /// TCT: Only highlight un-empty snippet
        if (fieldMatchedSnippet && !TextUtils.isEmpty(snippet)) {
            CharSequence snippetChars = TextUtilities.highlightTermsInText(snippet, mSearchParams.mFilter);
            snippetToHighlight.replace(0, snippet.length(), snippetChars);
        }/*from   w w w .j  a v a 2 s  .  c  o m*/
    }
    /// @}
    final Spannable displayedStringBuilder = new SpannableString(snippetToHighlight);

    // measure the width of the folders which overlap the snippet view
    final int folderWidth = mHeader.folderDisplayer.measureFolders(mCoordinates);

    // size the snippet view by subtracting the folder width from the maximum snippet width
    final int snippetWidth = mCoordinates.maxSnippetWidth - folderWidth;
    final int snippetHeight = mCoordinates.snippetHeight;
    mSnippetTextView.setLayoutParams(new ViewGroup.LayoutParams(snippetWidth, snippetHeight));
    mSnippetTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mCoordinates.snippetFontSize);
    layoutViewExactly(mSnippetTextView, snippetWidth, snippetHeight);

    mSnippetTextView.setText(displayedStringBuilder);
}

From source file:org.de.jmg.learn._MainActivity.java

public void SetViewsToVokMode() {
    if (_mBackgroundBack != null)
        _MeaningBG = _mBackgroundBack;/*from w  w w. j a  v  a  2  s  .c o m*/
    // _txtWord.setMaxLines(3);
    // _txtWord.setLines(1);
    _txtWord.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (60 * scale));
    _txtWord.setHorizontallyScrolling(false);

    // _txtKom.setMaxLines(3);
    // _txtKom.setLines(2);
    _txtKom.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (35 * scale));
    _txtKom.setHorizontallyScrolling(false);

    _txtMeaning1.setLines(1);
    _txtMeaning1.setSingleLine();
    _txtMeaning1.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (40 * scale));
    _txtMeaning1.setMaxLines(3);
    _txtMeaning1.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
    _txtMeaning1.setHorizontallyScrolling(false);
    //_txtMeaning1.setAutoLinkMask(0);
    if (_originalMovementmethod != null
            && _txtMeaning1.getMovementMethod() == LinkMovementMethod.getInstance()) {
        _txtMeaning1.setMovementMethod(_originalMovementmethod);
    }
    //_txtMeaning1.setVerticalScrollBarEnabled(false);

    //_txtMeaning1.requestFocus();
    //InputMethodManager Imn = (InputMethodManager) _main.getSystemService(Context.INPUT_METHOD_SERVICE);
    //Imn.showSoftInputFromInputMethod(_txtMeaning1.getWindowToken(), 0);

    //_txtMeaning1.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);

    _txtMeaning2.setVisibility(View.VISIBLE);
    _txtMeaning2.setLines(1);
    _txtMeaning2.setSingleLine();
    _txtMeaning2.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (40 * scale));
    _txtMeaning2.setMaxLines(3);
    _txtMeaning2.setHorizontallyScrolling(false);

    _txtMeaning3.setVisibility(View.VISIBLE);
    _txtMeaning3.setLines(1);
    _txtMeaning3.setSingleLine();
    _txtMeaning3.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (40 * scale));
    _txtMeaning3.setMaxLines(3);
    _txtMeaning3.setHorizontallyScrolling(false);

}

From source file:org.de.jmg.learn._MainActivity.java

public void SetViewsToCardmode() {
    // _txtWord.setMaxLines(3);
    // _txtWord.setLines(2);
    // _txtKom.setMaxLines(3);
    // _txtKom.setLines(2);

    _txtWord.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (40 * scale));
    _txtKom.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (30 * scale));

    _txtMeaning1.setSingleLine(false);/*from  w  w w . j ava 2  s  .c  o  m*/
    _txtMeaning1.setMaxLines(1000);
    _txtMeaning1.setLines(16);
    //_txtMeaning1.setMinLines(2);
    _txtMeaning1.setGravity(Gravity.TOP | Gravity.START);
    _txtMeaning1.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) (25 * scale));
    //_txtMeaning1.requestFocus();
    //InputMethodManager Imn = (InputMethodManager) _main.getSystemService(Context.INPUT_METHOD_SERVICE);
    //Imn.hideSoftInputFromInputMethod(_txtMeaning1.getWindowToken(), 0);
    if (_originalMovementmethod == null)
        _originalMovementmethod = _txtMeaning1.getMovementMethod();
    //_txtMeaning1.setAutoLinkMask(Linkify.ALL);
    if (_txtMeaning1.getMovementMethod() != LinkMovementMethod.getInstance())
        _txtMeaning1.setMovementMethod(LinkMovementMethod.getInstance());
    //_txtMeaning1.setVerticalScrollBarEnabled(true);
    //_txtMeaning1.setInputType(InputType.TYPE_NULL);
    // _txtMeaning1.setImeOptions(EditorInfo.IME_NULL);
    // _txtMeaning1.setImeActionLabel(null, KeyEvent.KEYCODE_ENTER);
    // _txtMeaning1.setImeActionLabel("Custom text",
    // KeyEvent.KEYCODE_ENTER);
    _txtMeaning2.setVisibility(View.GONE);
    _txtMeaning3.setVisibility(View.GONE);

    if (_MeaningBG != null)
        _mBackgroundBack = _MeaningBG;
    _MeaningBG = null;
    //if (_mBackgroundBack!=null) _MeaningBG = _mBackgroundBack;

}

From source file:org.openintents.notepad.NoteEditor.java

private void applyTheme() {
    mText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
    mText.setTypeface(mCurrentTypeface);
    mText.setTextColor(mTextColor);//from  w  w w .j  av a 2 s  .co  m

    if (mTextUpperCaseFont) {
        // Turn off autolinkmask, because it is not compatible with
        // transformationmethod.
        mText.setAutoLinkMask(0);

        mText.setTransformationMethod(UpperCaseTransformationMethod.getInstance());
    } else {
        mText.setTransformationMethod(null);

        // Set auto-link on or off, based on the current setting.
        int autoLink = PreferenceActivity.getAutoLinkFromPreference(this);

        mText.setAutoLinkMask(autoLink);
    }

    mText.invalidate();
}