Android: How to change the style of a ViewPager? -


activity_main.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">    <android.support.v4.view.viewpager     android:id="@+id/pager"     android:layout_width="match_parent"     android:layout_height="wrap_content">      <android.support.v4.view.pagertabstrip         android:id="@+id/pager_header"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_gravity="top"         android:padding="@dimen/abc_action_bar_content_inset_material" />   </android.support.v4.view.viewpager> </linearlayout> 

i'd apply different style viewpager , pagertabstrip . tried of default styles provided android change appearance of tab bar , indicators nothing happened. please, there useful styles purpose? maybe inherit , change attributes.

these related declaration in activity.java

public class mainactivity extends fragmentactivity 

and current style.xml

<!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light.darkactionbar">     <!-- customize theme here. --> </style> 

if looking change colors (accordingly theme), can customize theme, ex:

    <style name="apptheme" parent="theme.appcompat">         <item name="colorprimary">@color/md_light_blue_500</item>         <item name="colorprimarydark">@color/md_light_blue_700</item>         <item name="coloraccent">@color/md_blue_a200</item>     </style> 

and add background attribute:

<android.support.v4.view.pagertabstrip     android:id="@+id/pager_header"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_gravity="top"     android:background="?attr/colorprimarydark"     android:padding="@dimen/abc_action_bar_content_inset_material" /> 

hope gave ideas :)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -