Java Code Examples for android.widget.TextView#setHorizontalFadingEdgeEnabled()

The following examples show how to use android.widget.TextView#setHorizontalFadingEdgeEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NavigationPopup.java    From delion with Apache License 2.0 6 votes vote down vote up
public TextView createListItem() {
    TextView view = new TextView(mContext);
    view.setFadingEdgeLength(mFadeEdgeLength);
    view.setHorizontalFadingEdgeEnabled(true);
    view.setSingleLine();
    view.setTextSize(TEXT_SIZE_SP);
    view.setMinimumHeight(mListItemHeight);
    view.setGravity(Gravity.CENTER_VERTICAL);
    view.setCompoundDrawablePadding(mPadding);
    if (!mIsLayoutDirectionRTL) {
        view.setPadding(mPadding, 0, mPadding + mFadePadding , 0);
    } else {
        view.setPadding(mPadding + mFadePadding, 0, mPadding, 0);
    }
    return view;
}
 
Example 2
Source File: NavigationPopup.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
public TextView createListItem() {
    TextView view = new TextView(mContext);
    view.setFadingEdgeLength(mFadeEdgeLength);
    view.setHorizontalFadingEdgeEnabled(true);
    view.setSingleLine();
    view.setTextSize(TEXT_SIZE_SP);
    view.setMinimumHeight(mListItemHeight);
    view.setGravity(Gravity.CENTER_VERTICAL);
    view.setCompoundDrawablePadding(mPadding);
    if (!mIsLayoutDirectionRTL) {
        view.setPadding(mPadding, 0, mPadding + mFadePadding , 0);
    } else {
        view.setPadding(mPadding + mFadePadding, 0, mPadding, 0);
    }
    return view;
}
 
Example 3
Source File: NavigationPopup.java    From 365browser with Apache License 2.0 6 votes vote down vote up
public TextView createListItem() {
    TextView view = new TextView(mContext);
    view.setFadingEdgeLength(mFadeEdgeLength);
    view.setHorizontalFadingEdgeEnabled(true);
    view.setSingleLine();
    view.setTextSize(TEXT_SIZE_SP);
    view.setMinimumHeight(mListItemHeight);
    view.setGravity(Gravity.CENTER_VERTICAL);
    view.setCompoundDrawablePadding(mPadding);
    if (!mIsLayoutDirectionRTL) {
        view.setPadding(mPadding, 0, mPadding + mFadePadding , 0);
    } else {
        view.setPadding(mPadding + mFadePadding, 0, mPadding, 0);
    }
    return view;
}
 
Example 4
Source File: NavigationPopup.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public TextView createListItem() {
    TextView view = new TextView(mContext);
    view.setFadingEdgeLength(mFadeEdgeLength);
    view.setHorizontalFadingEdgeEnabled(true);
    view.setSingleLine();
    view.setTextSize(TEXT_SIZE_SP);
    view.setMinimumHeight(mListItemHeight);
    view.setGravity(Gravity.CENTER_VERTICAL);
    view.setCompoundDrawablePadding(mPadding);
    if (!mIsLayoutDirectionRTL) {
        view.setPadding(mPadding, 0, mPadding + mFadePadding , 0);
    }
    else {
        view.setPadding(mPadding + mFadePadding, 0, mPadding, 0);
    }
    return view;
}
 
Example 5
Source File: NavigationPopup.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public TextView createListItem() {
    TextView view = new TextView(mContext);
    view.setFadingEdgeLength(mFadeEdgeLength);
    view.setHorizontalFadingEdgeEnabled(true);
    view.setSingleLine();
    view.setTextSize(TEXT_SIZE_SP);
    view.setMinimumHeight(mListItemHeight);
    view.setGravity(Gravity.CENTER_VERTICAL);
    view.setCompoundDrawablePadding(mPadding);
    if (!mIsLayoutDirectionRTL) {
        view.setPadding(mPadding, 0, mPadding + mFadePadding , 0);
    }
    else {
        view.setPadding(mPadding + mFadePadding, 0, mPadding, 0);
    }
    return view;
}
 
Example 6
Source File: WebappUrlBar.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a WebappUrlBar.
 * @param context Context to grab resources from.
 */
public WebappUrlBar(Context context, AttributeSet attrSet) {
    super(context, attrSet);
    mIconResourceWidths = new SparseIntArray();

    mUrlBar = new TextView(context);
    mUrlBar.setSingleLine(true);
    mUrlBar.setGravity(Gravity.CENTER_VERTICAL);
    mUrlBar.setMovementMethod(ScrollingMovementMethod.getInstance());
    mUrlBar.setHorizontalFadingEdgeEnabled(true);
    mSeparator = new View(context);

    addView(mUrlBar,
            new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
                    Gravity.CENTER));
    addView(mSeparator,
            new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT, 1, Gravity.BOTTOM));

    // Set the colors.
    mSeparator.setBackgroundColor(ApiCompatibilityUtils.getColor(context.getResources(),
            R.color.webapp_url_bar_separator));
    setBackgroundColor(ApiCompatibilityUtils.getColor(context.getResources(),
            R.color.webapp_url_bar_bg));

    // Listen for changes in the URL bar's size.
    mUrlBar.addOnLayoutChangeListener(this);
}
 
Example 7
Source File: WebappUrlBar.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a WebappUrlBar.
 * @param context Context to grab resources from.
 */
public WebappUrlBar(Context context, AttributeSet attrSet) {
    super(context, attrSet);
    mIconResourceWidths = new SparseIntArray();

    mUrlBar = new TextView(context);
    mUrlBar.setSingleLine(true);
    mUrlBar.setGravity(Gravity.CENTER_VERTICAL);
    mUrlBar.setMovementMethod(ScrollingMovementMethod.getInstance());
    mUrlBar.setHorizontalFadingEdgeEnabled(true);
    mSeparator = new View(context);

    addView(mUrlBar,
            new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
                    Gravity.CENTER));
    addView(mSeparator,
            new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT, 1, Gravity.BOTTOM));

    // Set the colors.
    mSeparator.setBackgroundColor(ApiCompatibilityUtils.getColor(context.getResources(),
            R.color.webapp_url_bar_separator));
    setBackgroundColor(ApiCompatibilityUtils.getColor(context.getResources(),
            R.color.webapp_url_bar_bg));

    // Listen for changes in the URL bar's size.
    mUrlBar.addOnLayoutChangeListener(this);
}
 
Example 8
Source File: WebappUrlBar.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a WebappUrlBar.
 * @param context Context to grab resources from.
 */
public WebappUrlBar(Context context, AttributeSet attrSet) {
    super(context, attrSet);
    mIconResourceWidths = new SparseIntArray();

    mUrlBar = new TextView(context);
    mUrlBar.setSingleLine(true);
    mUrlBar.setGravity(Gravity.CENTER_VERTICAL);
    mUrlBar.setMovementMethod(ScrollingMovementMethod.getInstance());
    mUrlBar.setHorizontalFadingEdgeEnabled(true);
    mSeparator = new View(context);

    addView(mUrlBar,
            new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,
                    Gravity.CENTER));
    addView(mSeparator,
            new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT, 1, Gravity.BOTTOM));

    // Set the colors.
    mSeparator.setBackgroundColor(ApiCompatibilityUtils.getColor(context.getResources(),
            R.color.webapp_url_bar_separator));
    setBackgroundColor(ApiCompatibilityUtils.getColor(context.getResources(),
            R.color.webapp_url_bar_bg));

    // Listen for changes in the URL bar's size.
    mUrlBar.addOnLayoutChangeListener(this);
}
 
Example 9
Source File: CurrencyAmountView.java    From bither-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    final Context context = getContext();

    textView = (TextView) getChildAt(0);
    textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    textView.setHintTextColor(lessSignificantColor);
    textView.setHorizontalFadingEdgeEnabled(true);
    textView.setSingleLine();
    textView.setCompoundDrawablePadding(UIUtil.dip2pix(2));
    setHint(0);
    setValidateAmount(textView instanceof EditText);
    textView.addTextChangedListener(textViewListener);
    textView.setOnFocusChangeListener(textViewListener);
    textView.setOnEditorActionListener(textViewListener);

    contextButton = new View(context) {
        @Override
        protected void onMeasure(final int wMeasureSpec, final int hMeasureSpec) {
            setMeasuredDimension(textView.getCompoundPaddingRight(),
                    textView.getMeasuredHeight());
        }
    };
    final LayoutParams chooseViewParams = new LayoutParams(ViewGroup.LayoutParams
            .WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    chooseViewParams.gravity = Gravity.RIGHT;
    contextButton.setLayoutParams(chooseViewParams);
    this.addView(contextButton);

    updateAppearance();
}