Custom button style with font style - android

Going to create android app, but as client requirement.
I have to come up with custom style buttons and radio button.
Review the attached image
How can I make the button and input field same as 'bullet point 1'.
How to use custom Arabic font style.
(i.e https://fonts.google.com/specimen/Cairo)

For bullet point 1, I would suggest you to use 9-patch images with stretchable area on top & bottom lines & keeping the circular arc on left/right edges of same radius.
I can try to create same 9-patch image for you, but it's gonna take time :) (give me the color codes you want to use in)
For using Arabic fonts, please go through this Android Developer link Android Custom Fonts.
There are plenty of answers out there on how to use custom fonts, so you can easily find any one.
Here's how you can easily use that Cairo fonts types:
Download the Cairo font zip file, unzip it & put all .ttf or .otf files inside your Project -> app -> src -> main -> res -> font folder
Add below lines into your styles.xml file under res->values folder:
<style name="cairo_semi_bold">
<item name="android:fontFamily">#font/Cairo-SemiBold</item>
</style>
<style name="cairo_light">
<item name="android:fontFamily">#font/Cairo-Light</item>
</style>
Now you can apply these fonts either in XML or in .java files like this:
Typeface boldFont = getResources().getFont(R.font.cairo_semi_bold);
textView1.setTypeface(boldFont);
Typeface lightFont = getResources().getFont(R.font.cairo_light);
textView2.setTypeface(lightFont);

for changing the font you can use Calligraphy library here!
it's so easy to use
inside your xml fontPath="your font"
refer to the link for the complete guide

Related

Android: externalize "#android:color/transparent" in the colors.xml resources file

Hy,
I am using the next background colour #android:color/transparent for a ImageButton in the layout.xml. Could or should I externalize it in the colors.xml resources file?
Thanks
You could but it depends on your needs.
If you use that color in many different parts of your application it's best to place it in an external xml file. Sometimes you need to change the style of the whole application and it's easier to change the definition of that color instead of changing the color in many different places. If you're only using it in one single place then it is OK to leave it out of the external file.
EDIT:
<color name="my_background_color">#android:color/transparent</color>

Change the color of the selected TabItem footer

I cannot change the color of the bottom of the selected tab (TabItem) on the TabControl. I need to change from light blue to dark blue as at the top.
I'm using Firemonkey for Android and Delphi XE6.
Open Bitmap Style Designer (see a bin folder of IDE Rad Studio)
In Menu: File -> New -> Android Light Style for FireMonkey (or Dark style)
Expand node "Images". There are a several images for different screen scales.
Look at the style.png. Find a subimages for Tab. Tou can repaint this area. Don't forget, that you need to do it for all images (for all screen scales: style15, style20, style30)
Save style to file.
Styles:
use the following link to help you obtain original default style.From there you can use a copy of the style, and make changes as you wish via dropping a TStylebook and double clicking-> Loading your copied style -> after you make changes, then save and apply.. Then simply change the stylebook property for the form...
http://delphihaven.wordpress.com/2013/12/31/inspecting-platform-styles-redux/
May be theme generator will help you.
Change the style name [now example] and Set your theme, and Just download the zip, paste it in your resource folder, then change the theme in your manifest file, like
android:theme="#style/example"
I hope this will help you.

Android - styling custom Dialog

I have a custom dialog in an xml layout.
How can I style it so it:
doesn't have a title
in other cases when I do want a title, change the color of the title divider line
has completely square edges instead of those slightly rounded corners that Android dialogs have by default
android customising style link
There is style folder inside res folder. Please take look over it. it basically xml file which has resource tags where you can configure you custom styling. And refer the same styling from style attribute in xml.

Eclipse - Android TextView widget - No properties dialog

I am new to Eclipse and Android development so it is quite possible I am missing something that is obvious to others. I have a basic Android project and in the graphical layout editor for Activity_Main.xml I find that I am not able to access the property dialogs for most of the TextView properties. I have included a screen capture. I expected a dialog box listing possible color choices for the text or at least an area where I could type in a hex code. I am using Eclipse - Kepler Service Release 1. Thank you.
You have to choose a colour from a resource.
To do that, open up your Strings.xml file, and add a colour to it. Example:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">example</string>
<color name="PURPLE">#800080</color>
</resources>
Then in your activity_main.xml, add this property to your TextView (reference the resource):
android:textColor="#color/PURPLE"
and/or (for other widgets, such as buttons)
android:background="#color/PURPLE"
However, if you wanted the way you were doing it, you still can. After you created your color called PURPLE, you can click on the ellipsis (...) for Text Color, and then click the Color heading, and then select the color (PURPLE will be there, along with all of the other colors you create).
Sources:
How to change background color in android app
Web colors in an Android color xml resource file
TextView | Android Developers
Color | Android Developers
android:textSize

How to define style that use custom font

I would like to use Roboto font as default font for every TextViews, EditTexts, Buttons, etc in my app.
I've put the ttf file in the fonts folder inside assets folder. Now I would like to edit the app style, in order to use that font.
So, that's what I've done.
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:typeface">ROBOTO-REGULAR.TTF</item>
</style>
But the compiler returns this error.
String types not allowed (at 'android:typeface' with value 'ROBOTO-
REGULAR.TTF').
Is it possible to define via XML a default font for the app? In this case, what is wrong?
Thank you in advance.
You can't do it the way you want. The android:typeface attribute is an enum and has a fixed number of values. It doesn't take a filename.
What you can do is implement a custom TextView (plus custom Button and EditText inheriting from their respective classes) that reads a custom attribute and loads the font file that the attribute points to.
Bear in mind that Roboto is meant to be used from Honeycomb onwards (or was it ICS?). It does look a bit out of place on older devices, where Droid Sans is the system-wide default.

Categories

Resources