List of usage examples for android.widget TextView setGravity
public void setGravity(int gravity)
From source file:com.cssweb.android.quote.QHSCGridActivity.java
private void AddViewItem(int paramInt1, LinearLayout paramLinearLayout, int paramInt2, int paramInt3, int paramInt4, boolean paramBoolean) { TextView localTextView = new TextView(this); float f = this.mFontSize; localTextView.setTextSize(f);//from ww w .j a v a2 s .c o m localTextView.setGravity(Gravity.CENTER); localTextView.setFocusable(paramBoolean); localTextView.setOnClickListener(mClickListener); localTextView.setOnLongClickListener(mLongClickListener); localTextView.setOnTouchListener(this); // touch localTextView.setTag(paramInt2); localTextView.setEnabled(paramBoolean); localTextView.setSingleLine(true); Resources localResources = getResources(); Drawable localDrawable = null; if (paramInt4 == 0 && paramInt3 >= 0) {// int i1 = this.residTitleCol; int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = localResources.getDrawable(i1); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = localResources.getDrawable(this.residTitleScrollCol[2]); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; } else if (paramInt3 == 13) { localDrawable = localResources.getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 % 2 == 0) { localDrawable = localResources.getDrawable(this.residTitleScrollCol[1]); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = localResources.getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); } localTextView.setBackgroundDrawable(localDrawable); int i6 = localDrawable.getIntrinsicHeight(); localTextView.setHeight(i6 + CssSystem.getTableTitleHeight(this)); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } if (paramInt4 != 0 && paramInt3 >= 0) { int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = localResources.getDrawable(this.residCol); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = localResources.getDrawable(this.residScrollCol[2]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; } else if (paramInt3 == 13) { localDrawable = localResources.getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 % 2 == 0) { localDrawable = localResources.getDrawable(this.residScrollCol[1]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = localResources.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); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } }
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 . j a v a2 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);/*from www .j a v a2 s. c o 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 w ww. ja v a 2 s. c o m tab.setGravity(Gravity.CENTER); tab.setSingleLine(); tab.setPadding(0, 0, 0, 0); addTab(position, tab); }
From source file:com.adithyaupadhya.uimodule.roundcornerprogressbar.BaseRoundCornerProgressBar.java
private void previewLayout(Context context) { setGravity(Gravity.CENTER);//www . j a va2s.c o m TextView tv = new TextView(context); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); tv.setLayoutParams(params); tv.setGravity(Gravity.CENTER); tv.setText(getClass().getSimpleName()); tv.setTextColor(Color.WHITE); tv.setBackgroundColor(Color.GRAY); addView(tv); }
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);/*from www . j a va 2 s . 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); } }); tabsContainer.addView(tab); }
From source file:PagerSlidingTab.java
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title);/*from w w w .ja va 2 s . 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. j a v a 2s .c om*/ tab.setGravity(Gravity.CENTER); tab.setSingleLine(); 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 av a 2 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);/*from ww w . j av a 2 s . com*/ 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); }