Forum Xamarin.Android

How can I set selected tab background in Tabbed Page?

NorbertKNorbertK PLMember
edited April 2017 in Xamarin.Android

Hello

I have to do something, that I expected to be rivial, yet it isn't. I need to customize layout of tabbed page in my app and I've got stucked.

After not founding a solution for Xamarin Forms I tried to implement this part in a device specific code. I tried to implement this solution in my app Droid project.

So I've added tab_layout.xml file to Resources/drawable:
<?xml version="1.0" encoding="utf-8" ?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="#404454" android:state_selected="true"/> <item android:color="#ecedee"/> </selector>

And adden tab_layout.axml into Resources/layout:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.TabLayout app:tabBackground="@drawable/tab_color_selector" />

Unfortunetly, I'm getting such an error:

No resource found that matches the given name (at 'tabBackground' with value '@drawable/tab_color_selector').

I've tried to reach tabBackground in many different namespaces, like following, whith no success what so ever:

xmlns:app="android.support.design"
xmlns:app="android.support.design.widget"
xmlns:app="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"

Does anybody know how to get this done?

Sign In or Register to comment.