How to increase height of tab indicator

Lor*_*ren 2 android

I have created 3 tabs . But when i switch between tabs the height of tab indicator is very small,it comes like a thin line over tabs.I have not seen any post that gives me solution of this problem.All of them are about how to change the colour of tab indicator.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    try {

        setContentView(R.layout.activity_main);
        ActionBar bar = getActionBar();

        Log.d("In Tab Activity", bar.toString());
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        Tab tab1 = bar.newTab();
        tab1.setText("Contacts");
        tab1.setTabListener(this);
        bar.addTab(tab1);




        Tab tab2 = bar.newTab();
        tab2.setText("Messages");
        tab2.setCustomView(TabUtils.renderTabView(this, R.string.tab_invitations, R.drawable.ic_add_alert_black_24dp, 5));
        tab2.setTabListener(this);
        bar.addTab(tab2);


        Tab tab3 = bar.newTab();
        tab3.setText("History");
        tab3.setTabListener(this);
        bar.addTab(tab3);

        webView = (WebView) findViewById(R.id.webPage);
        jSInterface = new AndroidJSInterface(this);
        webView.addJavascriptInterface(jSInterface, "AndroidJSInterface");

        webView.loadUrl("file:///android_asset/HybridPage2.html", null);

        /*
         * Fragment main = new MainFragment(); FragmentTransaction ft =
         * getFragmentManager().beginTransaction();
         * ft.replace(R.id.content_frame, main);
         * ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
         * ft.addToBackStack(null); ft.commit();
         */
    } catch (Exception e) {
        Log.d("Exception is", e.getMessage());
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 5

您可以app:tabIndicatorHeight=".."在 TabLayout 下的 xml 文件中指定选项卡指示器高度。