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.findhotel.widget.PagerSlidingTabStrip.java

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

    TextView tab = new TextView(getContext());
    tab.setText(title);/*from w  ww . j  a  v a2  s  .  co  m*/
    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:com.easemob.easeui.widget.viewpagerindicator.PagerSlidingTabStrip.java

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

    TextView tab = new TextView(getContext());
    tab.setText(title);//from www  . j av a 2  s .com
    tab.setSingleLine();
    tab.setTextColor(tabTextColor);
    tab.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
    addTab(position, tab);

}

From source file:com.mozhuowen.widget.views.PagerSlidingTabStrip.java

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

    LinearLayout tab = new LinearLayout(getContext());
    tab.setGravity(Gravity.CENTER);//w ww  .j  a v a 2s  .  com
    tab.setOrientation(LinearLayout.VERTICAL);

    TextView titletext = new TextView(getContext());
    titletext.setText(title);
    titletext.setGravity(Gravity.CENTER);
    titletext.setSingleLine();

    TextView contenttext = new TextView(getContext());
    contenttext.setText(content);
    contenttext.setGravity(Gravity.CENTER);
    contenttext.setSingleLine();

    tab.addView(titletext);
    tab.addView(contenttext);

    addTab(position, tab);
}

From source file:dk.nordfalk.aktivitetsliste.PagerSlidingTabStrip.java

private void addIconTabBdeTekstOgBillede(final int position, int resId, String title) {
    FrameLayout tabfl = new FrameLayout(getContext());
    ImageView tabi = new ImageView(getContext());
    tabi.setContentDescription(title);//from  w  w  w  . j  a v a2 s  .c  om
    tabi.setImageResource(resId);
    tabi.setVisibility(View.INVISIBLE);
    TextView tabt = new TextView(getContext());
    tabt.setText(title);
    tabt.setGravity(Gravity.CENTER);
    tabt.setSingleLine();

    tabfl.addView(tabi);
    tabfl.addView(tabt);

    LayoutParams lp = (LayoutParams) tabi.getLayoutParams();
    lp.gravity = Gravity.CENTER;
    lp = (LayoutParams) tabt.getLayoutParams();
    lp.width = lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
    lp.gravity = Gravity.CENTER;

    addTab(position, tabfl);
}

From source file:com.dashihui.afford.ui.widget.WdtPagerTabServerTime.java

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

    TextView tab = new TextView(getContext());
    tab.setText(title);/* w ww  . j  a  va2  s.  com*/
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    //      tab.setBackgroundResource(R.drawable.servicetime_btn_label_bottom);/////////

    addTab(position, tab);
    mTextViewMap.put(position, tab);
}

From source file:com.meishai.ui.sliding.PagerSlidingTabStrip.java

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

    TextView tab = new TextView(getContext());
    //      LinearLayout.LayoutParams ls = new LinearLayout.LayoutParams();
    tab.setText(title);//from  w w  w .  ja  va2  s  .  c o  m
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    addTab(position, tab);
}

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

private void addCmTab(final int position, String title, int resId) {
    RelativeLayout tab = (RelativeLayout) inflate(getContext(), R.layout.cm_pst__tab, null);
    ImageView iv = (ImageView) tab.findViewById(R.id.pst_iv_tab);
    iv.setImageResource(resId);//from  w w  w. j a  v a 2s.c o m
    iv.setVisibility(View.VISIBLE);
    TextView tv = (TextView) tab.findViewById(R.id.pst_tv_tab);
    tv.setText(title);
    tv.setGravity(Gravity.CENTER);
    tv.setSingleLine();
    tab.setFocusable(true);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (null != mOnPageClickedLisener) {
                mOnPageClickedLisener.onPageClicked(position);
            }
            pager.setCurrentItem(position);
        }
    });

    tabsContainer.addView(tab);
}

From source file:asia.utopia.musicoff.view.PagerSlidingTabStrip.java

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

    TextView tab = new TextView(getContext());
    tab.setText(title);/*from w w w .  java  2 s.com*/
    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:com.astuetz.PagerSlidingTabStripMenu.java

private void addIconTab2(final int position, String title, int resId) {

    TextView tab = new TextView(getContext());
    tab.setText(title);/*w ww.jav  a  2s  . co  m*/
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setCompoundDrawablePadding(mTabDrawablePadding);

    switch (mIconPostion) {
    case Left:
        tab.setCompoundDrawablesWithIntrinsicBounds(resId, 0, 0, 0);
        break;
    case Top:
        tab.setCompoundDrawablesWithIntrinsicBounds(0, resId, 0, 0);
        break;
    case Right:
        tab.setCompoundDrawablesWithIntrinsicBounds(0, 0, resId, 0);
        break;
    case Bottom:
        tab.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, resId);
        break;
    }

    addTab(position, tab);
}

From source file:com.hua.weget.PagerSlidingTabStrip.java

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

    TextView tab = new TextView(getContext());
    tab.setText(title);/*from  www . j av  a  2 s . c o m*/
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setPadding(0, 0, 0, 0);
    addTab(position, tab);
}