Note that there are some explanatory texts on larger screens.

plurals
  1. POTab Indicator colour
    text
    copied!<p><img src="https://i.stack.imgur.com/K24gw.png" alt="enter image description here">How to set the tabindicator colour of the tab widget without using image.</p> <pre><code>private TextView makeTabIndicator(String text, Context context) { int tabHeight = 44; //String tab_text_color = context.getString(R.string.fixed_tab_text_color); TextView tabView = new TextView(getContext()); tabView.setBackgroundColor(Utils.getColor("#0a223a")); LayoutParams lp3 = new LayoutParams(LayoutParams.WRAP_CONTENT, CommonUtils.getDimension(tabHeight), 1); //lp3.setMargins(1, 0, 1, 0); tabView.setLayoutParams(lp3); tabView.setText(text); //tabView.setTextColor(Utils.getColor(tab_text_color)); tabView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); ColorDrawable unselectedState = new ColorDrawable(Utils.getColor("2c8efd")); ColorDrawable selectedState = new ColorDrawable(Utils.getColor("00ffff")); ColorDrawable focusState = new ColorDrawable(Utils.getColor("ffffff")); ColorDrawable pressedState = new ColorDrawable(Utils.getColor("")); StateListDrawable sld = new StateListDrawable(); sld.addState(new int[] { android.R.attr.state_selected }, selectedState); sld.addState(new int[] { android.R.attr.state_pressed }, pressedState); sld.addState(new int[] { android.R.attr.state_focused }, focusState); sld.addState(new int[] {}, unselectedState); tabView.setBackgroundDrawable(sld); tabView.setPadding(2, 0, 2, 0); return tabView; } </code></pre> <p>This is setting the colour for the entire tab. But, i want to give the colour only for the line below the tab text with a height of 5dp. Please let me know how we can achieve this.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload