No style applied using AndroidImageSlider - android

I'm using AndroidImageSlider (https://github.com/daimajia/AndroidImageSlider) in my app but I cant apply custom design in the page indicator. I'm using Eclipse, I download the proyect and add as a library
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="#+id/viewFlipper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:addStatesFromChildren="true"
android:background="#color/azul_us"
android:orientation="vertical" >
<com.daimajia.slider.library.SliderLayout
android:id="#+id/slider"
android:layout_width="match_parent"
android:layout_height="200dp" />
<com.daimajia.slider.library.Indicators.PagerIndicator
android:id="#+id/custom_indicator"
style="#style/AndroidImageSlider_Magnifier_Oval_Black" />
</LinearLayout>
<style name="AndroidImageSlider_Magnifier_Oval_Black">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">right</item>
<item name="android:paddingLeft">2dp</item>
<item name="android:paddingRight">2dp</item>
<item name="shape">rect</item>
<item name="padding_left">3dp</item>
<item name="padding_right">3dp</item>
<item name="padding_top">4dp</item>
<item name="padding_bottom">4dp</item>
<item name="selected_color">#7ac943</item>
<item name="unselected_color">#33000000</item>
<item name="selected_width">8dp</item>
<item name="selected_height">8dp</item>
<item name="unselected_width">6dp</item>
<item name="unselected_height">6dp</item>
</style>
Thanks!!!!!

I forgot add this line
slider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));

Related

Navigation view text size wont change in android studio

Im trying to change the size of the item text of my navigation view in android studio but every time it appears the same. I have tried creating an style like the following:
<style name="ItemStyle">
<item name="android:textSize">20dp</item>
<item name="android:textStyle">bold</item>
</style>
or
<style name="ItemStyle">
<item name="android:textSize">20sp</item>
<item name="android:textStyle">bold</item>
</style>
or
<style name="ItemStyle" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:textSize">20dp</item>
<item name="android:textStyle">bold</item>
</style>
but none of these seem to work this is my navigation view code
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_gravity="start"
android:layout_height="match_parent"
app:theme="#style/ItemStyle"
android:id="#+id/navigationView"
app:menu="#menu/nav_menu"
app:headerLayout="#layout/nav_header"
>
also here is my nav_menu code
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:id="#+id/nav_home"
android:icon="#drawable/homeicon"
android:title="Home" />
<item
android:id="#+id/nav_invite"
android:icon="#drawable/invite"
android:title="Invite friends" />
<item
android:id="#+id/nav_history"
android:icon="#drawable/history"
android:title="Ride history" />
<item
android:id="#+id/nav_payment"
android:icon="#drawable/payment"
android:title="Payment" />
<item
android:id="#+id/nav_help"
android:icon="#drawable/help"
android:title="Help" />
<item
android:id="#+id/nav_settings"
android:icon="#drawable/settings"
android:title="Settings" />
<item
android:id="#+id/nav_driver"
android:icon="#drawable/drive"
android:title="Drive" />
</menu>
I would appreciate if someone can help find out whats wrong with it. Thanks
You can also try the textAppearance
Your style:
<style name="MyDesign" parent="Base.TextAppearance.AppCompat">
<item name="android:textSize">26sp</item>
<item name="android:textStyle">bold</item>
</style>
Implementation:
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_gravity="start"
android:layout_height="match_parent"
app:itemTextAppearance="#style/MyDesign"
android:id="#+id/navigationView"
app:menu="#menu/nav_menu"
app:headerLayout="#layout/nav_header"
>

How to set the Color of the item title in navigationDrawer?

I am stuck in my own code. I can't find where to set the color of the "Title" text, in the navigationDrawer, to the defualt gray.
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:background="#000"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_gravity="start"
app:headerLayout="#layout/header"
app:itemTextColor="your color"
app:menu="#menu/drawer" />
app:itemTextColor="your color" only changes each item, like Import, Gallery etc. But how to change the Communicate textColor with the line above?
Picture 2 (dark blue) is what it looks like in my project. I managed to "somewhere" set the color to white in my project.
Can you find my problem? Currently my "Title" text is white..
nav_header_main.xml
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="#dimen/nav_header_vertical_spacing"
android:src="#android:drawable/sym_def_app_icon"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/nav_header_vertical_spacing"
android:textColor="#color/whiteGray"
android:text="#string/app_name"
/>
</LinearLayout>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start"
>
<include
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:background="#color/nav_drawer_background"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="#menu/activity_main_drawer"
app:headerLayout="#layout/nav_header_main"
app:itemTextColor="#color/nav_drawer_text" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_right_view"
android:background="#color/nav_drawer_background"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
android:fitsSystemWindows="true"
app:menu="#menu/activity_main_right_drawer"
app:itemTextColor="#color/nav_drawer_text" />
</android.support.v4.widget.DrawerLayout>
app_bar_main.xml
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="#style/AppTheme.PopupOverlay"
/>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
/>
values/style.xml
<style name="WelcomeDialogTitle">
<item name="android:gravity">center_horizontal</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">#color/darkblue</item>
<item name="colorPrimary">#color/transparent</item>
<item name="colorPrimaryDark">#color/darkblue</item>
<item name="colorAccent">#color/darkblue</item>
</style>
<style name="AppTheme.NoActionBar" parent="#style/Theme.AppCompat">
<item name="android:windowBackground">#color/darkblue</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorPrimary">#color/transparent</item>
<item name="colorPrimaryDark">#color/transparent</item>
<item name="colorAccent">#color/transparent</item>
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
</style>
<style name="CustomTheme" parent="#android:style/Theme.Black">
<item name="android:listViewStyle">#style/CustomListView</item>
<item name="android:textViewStyle">#style/CustomTextView</item>
</style>
<style name="CustomListView" parent="#android:style/Widget.ListView">
<item name="android:textColor">#000000</item>
<item name="android:fastScrollEnabled">true</item>
</style>
<style name="CustomTextView" parent="#android:style/Widget.TextView">
<item name="android:textColor">#000000</item>
<item name="android:textSize">17sp</item>
<item name="android:padding">1dp</item>
</style>
<style name="TitleTextStyleLarge">
<item name="android:gravity">left|center</item>
<item name="android:shadowColor">#color/white</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textColor">#color/white</item>
<item name="android:textSize">18sp</item>
</style>
<style name="TitleTextStyle">
<item name="android:gravity">left|center</item>
<item name="android:textSize">18sp</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_marginLeft">5dp</item>
<item name="android:layout_weight">1</item>
<!-- <item name="android:shadowColor">#color/white</item> -->
<item name="android:textColor">#color/white</item>
</style>
<style name="BarTitleStyle">
<item name="android:background">#drawable/bg_list_topbar</item>
<item name="android:layout_height">33dp</item>
<!-- <item name="android:shadowColor">#color/white</item> -->
<item name="android:layout_width">fill_parent</item>
</style>
<style name="BarTitleProgressStyle">
<item name="android:background">#drawable/bg_list_topbar</item>
<item name="android:layout_height">27dp</item>
<item name="android:layout_width">27dp</item>
<item name="android:layout_marginBottom">1dp</item>
<item name="android:layout_marginRight">5dp</item>
<item name="android:layout_marginTop">1dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:gravity">center_vertical|center_horizontal</item>
</style>
</resources>
My activity theme
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
>
<meta-data
drawer.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="#+id/nav_search"
android:title="#string/LabelSearchTabTitle" />
<item
android:id="#+id/nav_wiki"
android:title="#string/LabelTitleWikiBook" />
<item
android:id="#+id/nav_forum"
android:title="#string/LabelTitleForum"
/>
<item
android:id="#+id/nav_history"
android:title="#string/LabelHistory"
/>
<item
android:id="#+id/nav_favs"
android:title="#string/LabelFavourites"
/>
</group>
<item android:title="#string/LabelTitleSupportPages">
<menu>
<item
android:id="#+id/nav_options"
android:title="#string/LabelTitleSettings" />
<item
android:id="#+id/nav_qa"
android:title="#string/LabelTitleAbout" />
<item
android:id="#+id/nav_facebook"
android:title="#string/LabelTitleFB" />
</menu>
</item>
</menu>
Try :
<item name="android:textColorSecondary">#eeeeee</item>
Edit :
Replace :
<style name="AppTheme.NoActionBar" parent="#style/Theme.AppCompat">
<item name="android:windowBackground">#color/darkblue</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
With This :
<style name="AppTheme.NoActionBar" parent="#style/Theme.AppCompat">
<item name="android:windowBackground">#color/darkblue</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:textColorSecondary">#eeeeee</item>
</style>
Edit 2 :
<style name="AppTheme.NoActionBar" parent="#style/Theme.AppCompat">
<item name="android:windowBackground">#color/darkblue</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
// change header color
<item name="android:textColorSecondary">#eeeeee</item>
// change separator color
<item name="android:listDivider">#ff000000</item>
</style>
You can make a custom layout for your Drawer items and include the custom layout in NavigationView.. Like this
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<include
layout="#layout/sidedrawer"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
</android.support.design.widget.NavigationView>
sidedrawer is your custom layout and you can provide it any style or color you want.. hope it will help you

Android v21 no Text in Actionbar

I have no text in my actionbar! What's wrong with this code? There is only a blue background. I tried some different suggestions. If I try it with primary color and so on, there is a shadow which cannot be removed.
style.xml:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="android:Theme.Material">
<item name="android:colorPrimary">#color/blue</item>
<item name="android:colorPrimaryDark">#color/blue</item>
<item name="android:colorAccent">#color/white</item>
<item name="android:textColor">#color/black</item>
<item name="android:windowBackground">#color/white</item>
<item name="android:actionBarStyle">#style/MyActionBarTheme</item>
</style>
<style name="MyActionBarTheme" parent="AppTheme">
<item name="android:background">#color/blue</item>
<item name="android:textColor">#color/white</item>
<item name="android:textSize">20sp</item>
</style>
</resources>
This is the XML-File:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/first"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:focusable="true"
android:focusableInTouchMode="true">
<RelativeLayout
android:id="#+id/header"
android:elevation="10dp"
android:background="#color/blue">
...
</RelativeLayout>
<ScrollView>
...
</ScrollView>
</RelativeLayout>

I need change the color to border of the check box,Because it is in white color

I have check box in my contacts list to select that. But check box is in white color,it is not visible...So i need to change that border to black color...Please help me to change the code
This is my layout code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:dividerVertical"
android:showDividers="middle"
android:dividerPadding="5dp"
tools:context=".MainActivity" >
<ImageButton
android:id="#+id/image"
android:layout_width="#dimen/contact_image"
android:layout_height="50dp"
android:src="#drawable/contacts_image" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
android:clickable="false"
android:focusable="true"
android:orientation="vertical" >
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="0dp"
android:paddingTop="1dp"
android:textColor="#color/black"
android:textSize="18sp"
/>
<TextView
android:id="#+id/mobile_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="15sp"
android:paddingLeft="5dp"
android:paddingRight="0dp"
/>
</LinearLayout>
<CheckBox
android:id="#+id/check_box"
android:layout_width="#dimen/check_box_width"
android:layout_height="50dp"
android:visibility="visible"
android:clickable="true"/>
</LinearLayout>
This is my style.xml code
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#color/scandal</item>
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
<style name="ActionBarCompat">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">50dp</item>
<item name="android:orientation">horizontal</item>
</style>
<style name="DashboardButton">
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:drawablePadding">2dp</item>
<item name="android:textSize">16dp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#ff29549f</item>
<item name="android:background">#null</item>
</style>
<style name="FooterBar">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">40dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">#dedede</item>
</style>
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
</resources>
instead changing the default in style xml file. do this.
create this your_custom.xml file and and save it in drawable folder
your_custom.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/unselected" android:state_checked="false"><color android:textColor="#your_color" />
</item>
<item android:drawable="#drawable/selected" android:state_checked="true"><color android:textColor="#your_color" />
</item>
<item android:drawable="#drawable/uncheck"></item>
<!-- default -->
</selector>
you will have to create three images for checkbox display
1.selected
2.unselect
3.uncheck
after all this done set attribute to your checkbox in layout
android:button="#drawable/your_custom"

How to hide Title in `Theme.Sherlock.Dialog`?

My DialogActivities extends from SherlockFragmentActivity. So I must to use Sherlock themes.
In values-v14 I hide Title like this:
<style name="Theme.Sherlock.Dialog" parent="#android:style/Theme.Holo.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
How to hide Title in Theme.Sherlock.Dialog in values folder?
By default it looks like this (github.com):
<style name="Theme.Sherlock.Dialog" parent="android:Theme">
<item name="android:windowFrame">#null</item>
<item name="android:windowTitleStyle">#style/DialogWindowTitle.Sherlock</item>
<item name="android:windowBackground">#drawable/abs__dialog_full_holo_dark</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowAnimationStyle">#android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimAmount">0.6</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:textColorPrimary">#color/abs__primary_text_holo_dark</item>
<item name="android:textColorPrimaryInverse">#color/abs__primary_text_holo_light</item>
<item name="windowMinWidthMajor">#dimen/abs__dialog_min_width_major</item>
<item name="windowMinWidthMinor">#dimen/abs__dialog_min_width_minor</item>
<item name="windowActionBar">false</item>
<item name="windowContentOverlay">#null</item>
</style>
Solution:
I've changed abs__dialog_title_holo.xml by adding two lines in: https://github.com/JakeWharton/ActionBarSherlock/blob/master/library/res/layout/abs__dialog_title_holo.xml
<com.actionbarsherlock.internal.widget.FakeDialogPhoneWindow xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fitsSystemWindows="true">
<TextView android:id="#android:id/title" style="?android:attr/windowTitleStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="#dimen/abs__alert_dialog_title_height"
android:visibility="gone" //******** FIRST ********
android:paddingLeft="16dip"
android:paddingRight="16dip"
android:gravity="center_vertical|left" />
<View android:id="#+id/abs__titleDivider"
android:layout_width="fill_parent"
android:visibility="gone" //******** SECOND ********
android:layout_height="2dip"
android:background="#color/abs__holo_blue_light" />
<FrameLayout
android:layout_width="match_parent" android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:foreground="?attr/windowContentOverlay">
<FrameLayout android:id="#+id/abs__content"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>

Categories

Resources