0

I recently developed an app, which has swipeable tabs, I have taken the tabs text in my java code, I want to increase the size of the tabs text, how can it be done..

The following is the sample code,

  private ViewPager viewPager;
    private TabsPagerAdapter mAdapter;
    private ActionBar actionBar;
    // Tab titles
    private String[] tabs = { "मुख्य समाचार", "स्टेट", "दुनिया" ,"राष्ट्रीय" ,"खेल" ,"व्यापार" ,"मनोरंजन" ,"स्वास्थ्य" ,"लाइफस्टाइल" ,"क्रिकेट" ,"ऐशिया" ,"अमेरिका" , "फ़ुटबॉल" , "मध्य प्रदेश", "छत्‍तीसगढ़" , "महाराष्ट्र" , "गोवा" , "उत्तर प्रदेश"};


    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @SuppressLint("NewApi")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        getActionBar().setDisplayHomeAsUpEnabled(true);

            getActionBar().setHomeButtonEnabled(true);
         ..........
         .............
Mirnal Mannu
  • 93
  • 1
  • 10
  • Check [this](http://stackoverflow.com/questions/24822492/how-to-change-swipe-tabs-text-size-for-different-screen-size-i-am-using-fragmen) – Skynet Apr 24 '15 at 13:30
  • Check the answer for [ActionBar tabs set dynamic width according to screen width](http://stackoverflow.com/questions/29339797/actionbar-tabs-set-dynamic-width-according-to-screen-width/29428695#29428695) – Xcihnegn Apr 24 '15 at 13:40
  • [Check an answer for your question ](https://stackoverflow.com/a/47154904/7437508) – Hossam elsawy Nov 07 '17 at 11:15
  • [please chek this link for answer ](https://stackoverflow.com/a/47154904/7437508) – Hossam elsawy Nov 07 '17 at 11:17

1 Answers1

0

Skynet has right link of solution and may be below is one another solution to set size programmatically. Use it after adding all tabs.

for (int i = 0; i < this.mTabHost.getTabWidget().getChildCount(); i++) {
            View v = this.mTabHost.getTabWidget().getChildAt(i);
            TextView tv = (TextView) v.findViewById(android.R.id.title);
            tv.setTextSize(TypedValue.COMPLEX_UNIT_PX,20);      
        }
Kirankumar Zinzuvadia
  • 1,249
  • 10
  • 17
  • hey, i want to do it programatticaly that you gave the solution, the only problem is that , it says that , can't use getTabWidget for string types array this is the msg shown.. Cannot invoke getTabWidget() on the array type String[] – Mirnal Mannu Apr 24 '15 at 13:48
  • Here in **mTabHost.getTabWidget()** mTabHost is instance of **TabHost** . Can you show snippet how you are adding tabs to your activity. – Kirankumar Zinzuvadia Apr 25 '15 at 15:24