0
我想在操作欄中定製選項卡。它在許多設備上工作正常,但有時其寬度未設置爲match_parent。我已經使用textview作爲自定義佈局。我試過很多東西就像我在style.xml如何更改自定義選項卡的寬度?
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="android:padding">0dp</item> </style>
但是從上解決我的其他佈局變得如此stucked了改變。所以如果有人知道如何擴大自定義選項卡的大小match_parent比它真的會幫我謝謝你
==>這是從那裏我嘗試設置的TextView我的代碼爲製表符
TextView textView=new TextView(getApplicationContext());
textView.setText(tab_name);
textView.setGravity(Gravity.CENTER);
textView.setTextSize(20.0f);
textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
textView.setPadding(20,0,20,0);
textView.setBackgroundColor(Color.parseColor("#ffffff"));
textView.setTextColor(Color.parseColor("#000000"));
textView.setTypeface(customFont);
actionBar.addTab(actionBar.newTab().setText(tab_name).setCustomView(textView)
.setTabListener(this));
給予從左到右的平等填充這些textviews的佈局 – 2015-04-01 09:20:43
@AnshulTyagi它沒有工作。 :( – 2015-04-01 09:29:15
張貼您的xml代碼並提及它們。我會爲您編輯 – 2015-04-01 09:29:49