How to set Toolbar text and back arrow color

Chances are you are extending from the wrong parent. If not, you can try adding the style to the toolbar layout directly, if you want to override the theme’s settings. In your toolbar layout: <android.support.v7.widget.Toolbar xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” android:minHeight=”?attr/actionBarSize” app:theme=”@style/ToolBarStyle” app:popupTheme=”@style/ToolBarPopupStyle” android:background=”@color/actionbar_color” /> In your styles: <!– ToolBar –> <style name=”ToolBarStyle” parent=”Theme.AppCompat”> <item … Read more

Style bottom Line in Android

It’s kind of a hack, but I think this is probably the best way to do it. The dashed line will always be on the bottom, regardless of the height. <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item> <shape android:shape=”rectangle” > <solid android:color=”#1bd4f6″ /> </shape> </item> <item android:top=”-2dp” android:right=”-2dp” android:left=”-2dp”> <shape> <solid android:color=”@android:color/transparent” /> <stroke android:dashGap=”10px” android:dashWidth=”10px” android:width=”1dp” android:color=”#ababb2″ /> … Read more

How do you underline a text in Android XML?

If you are using a string resource xml file (supports HTML tags), it can be done using<b> </b>, <i> </i> and <u> </u>. <resources> <string name=”your_string_here”> This is an <u>underline</u>. </string> </resources> If you want to underline something from code use: TextView tv = (TextView) view.findViewById(R.id.tv); SpannableString content = new SpannableString(“Content”); content.setSpan(new UnderlineSpan(), 0, content.length(), … Read more

Using App namespace in style

For app namespace you don’t need to specify app:<property name>. Just <property name> is enough. For example <style name=”FabStyle” parent=”Widget.Design.FloatingActionButton”> <item name=”android:layout_width”>wrap_content</item> <item name=”android:layout_height”>wrap_content</item> <item name=”android:layout_margin”>16dp</item> <item name=”backgroundTint”>@color/accent</item> <item name=”layout_anchorGravity”>end|bottom</item> </style> And for layout_anchorGravity you need to set it in XML file where you are defining Floating action button.

How to make a smaller RatingBar?

How to glue the code given here … Step-1. You need your own rating stars in res/drawable … Step-2 In res/drawable you need ratingstars.xml as follow … <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:id=”@android:id/background” android:drawable=”@drawable/star_empty” /> <item android:id=”@android:id/secondaryProgress” android:drawable=”@drawable/star_empty” /> <item android:id=”@android:id/progress” android:drawable=”@drawable/star” /> </layer-list> Step-3 In res/values you need styles.xml as follow … <?xml … Read more

Custom attributes in styles.xml

I figured it out! The answer is to NOT specify the namespace in the style. <?xml version=”1.0″ encoding=”utf-8″ ?> <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”CustomStyle”> <item name=”android:layout_width”>wrap_content</item> <item name=”android:layout_height”>wrap_content</item> <item name=”custom_attr”>value</item> <!– tee hee –> </style> </resources>

How to change color of the back arrow in the new material theme?

You can achieve it through code. Obtain the back arrow drawable, modify its color with a filter, and set it as back button. final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha); upArrow.setColorFilter(getResources().getColor(R.color.grey), PorterDuff.Mode.SRC_ATOP); getSupportActionBar().setHomeAsUpIndicator(upArrow); Revision 1: Starting from API 23 (Marshmallow) the drawable resource abc_ic_ab_back_mtrl_am_alpha is changed to abc_ic_ab_back_material. EDIT: You can use this code to achieve the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)