Example usage for android.widget TextView setSingleLine

List of usage examples for android.widget TextView setSingleLine

Introduction

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

Prototype

public void setSingleLine() 

Source Link

Document

Sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input.

Usage

From source file:com.example.helloandroid.animation.PagerSlidingTabStrip.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);// ww  w .j av a 2 s. c om
    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);

}

From source file:PagerSlidingTab.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);//w w w . ja v a 2s  .co m
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    tab.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });

    tabsContainer.addView(tab);

}

From source file:com.cc.custom.uikit.PagerSlidingTabStrip.java

private void addTextTab(final int position, CharSequence title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);/*from w w w  . ja  v  a 2 s .c  o  m*/
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    addTab(position, tab);
}

From source file:com.zch.safelottery.view.PagerSlidingTabStrip.java

private void addTextTab(final int position, String title) {

    final int color = tabTextColor;
    TextView tab = new TextView(getContext());
    tab.setText(title);/*  w w w . j  a  v a2 s  .co m*/
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(color);
    if (position == 0) {
        tab.setTextColor(indicatorColor);
    }
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            int childCount = tabsContainer.getChildCount();
            for (int i = 0; i < childCount; i++) {
                TextView child = (TextView) tabsContainer.getChildAt(i);
                child.setTextColor(color);
            }
            TextView cur = (TextView) tabsContainer.getChildAt(position);
            cur.setTextColor(indicatorColor);
            pager.setCurrentItem(position);
        }
    });

    tabsContainer.addView(tab);

}

From source file:com.summer.helper.view.PagerSlidingTabStrip.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);//from  w  w w .ja  va  2s  .  c o m
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    setClick(tab);
    addTab(position, tab);
}

From source file:com.yibu.headmaster.lib.PagerSliding.PagerSlidingTab.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);/*from w w w .  j ava2s .c o m*/
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position, false);
        }
    });

    tabsContainer.addView(tab);

}

From source file:com.yaozu.object.widget.PagerSlidingTabStrip.java

private void addTextTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setContentDescription(title);/*from ww w. java2 s  . c om*/
    tab.setText(title);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(tabTextColorNormal); // add by hangl

    addTab(position, tab);
}

From source file:com.inspiron.googlegoogle.UI.View.PagerSlidingTab.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);//from ww w . j  a v  a2 s  .co m
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    //      LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) tab.getLayoutParams ();
    //      layoutParams.setMargins (0,10,0,10);
    //      tab.setLayoutParams (layoutParams);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });

    tabsContainer.addView(tab);

}

From source file:com.liushengfan.test.customerviewgroup.view.PagerSlidingTabStrip.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);//ww w . j a va  2 s .co m
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    // add arrow
    if (compoundTabIndex != -1 && compoundDrawable != null && position == compoundTabIndex) {

        int h = DensityUtil.dip2px(getContext(), tabTextSize - 2);

        compoundDrawable.setBounds(0, 0, h / 3, h);

        tab.setCompoundDrawables(null, null, compoundDrawable, null);
    }
    addTab(position, tab);
}

From source file:com.example.fan.horizontalscrollview.PagerSlidingTabStrip.java

public TextView getTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);//from  w ww . jav  a  2  s .co  m
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(getResources().getColorStateList(
            mTextChangeable ? R.color.pst_tab_changeable_text_selector : R.color.pst_tab_text_selector));
    tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18.0f);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (null != mOnPageClickedLisener) {
                mOnPageClickedLisener.onPageClicked(position);
            }
            pager.setCurrentItem(position);
        }
    });

    return tab;
}