Styled Toggle Buttons in Android - android

I was reading the tutorial on Styling the Android toggle button here. The author asks us to create the 9patch drawable for both. I have trying to do this all morning, but have not been able to. Could anyone share the images with me, or tell me where i can get them ?
Kind Regards

You can find the 9patch drawable tool in the SDK folder in the tools folder.
It's a very useful tool for creating 9patch images, and you should be able to make your toggle button with it

There are links to 9-patches here: https://stackoverflow.com/a/15640365/2066079
The ones provided will style your togglebuttons to look like switches (which are only available in v14+)

Related

AndroidStudio Adding an image to draw with srcCompat

I am trying to do a drawer activity with Android Studio and I'm wanting to personalize the icons used. I've downloaded the icons I want to use and for the most part, it's okay.
In fact, I can modify all the android:icon icons but I have no idea how to modify the app:srcCompat icons. I don't know how to detect the image I want to use in this case...
Do you know how I can do it? Could you explain this to me?
Thanks a lot!
Edit: The file I'm working on as a base is the generated project with Drawer activity as the main activity. For example, if I wanted to modify the icon in the nav_header_main.xml file, how could I do to have my image (.png) transformed in a way detected by Android Studio as compatible with srcCompat
Ensure your image file is in res/drawable folder(or drawable-xhdpi/xxhdpi, determined by your design)
Refer it by app:srcCompact="#drawable/$IMAGE_FILE_NAME" in your xml.
Then you should see what you want.
Please check the doc to further understand the official usage.
Well... I was blind! I was wondering how I could add my icons but they were, I was just mistaking on the address... #android:drawable/... is obviously not #drawable/... but I didn't notice. So be aware that there is a difference and it'll be okay I think!

Making the actionBar Cool

How can i make the ActionBar Epic as this one ?
Also normally in Google Apps, when we swipe down the action bar actually get shrinked down in size with a beautiful effect, is that effect available for developers? or we have to do it on our own ? And how can we do it?
In this image overhere, there's icon and text above the image, and also a rounded button, i wonder if this sample is documented and i'm missing it, hope guys you'll point that out!
Also how can they add text to the ActionBar??
Hope you'll help! Thanks!
This is all from the new Materials Theme that is going to be available in the next version of Android. You can find out more at the Android L Developer Preview site.
You may use this project available on github to implement your epic actionbar.
Regarding icons/buttons, simply use drawables or 9-patch to get it done.

How to customize android widgets

Hi I am a beginner in android and I want to know how to customize buttons,check box etc., I searched in web but found many ways and got confused...
Can you please tell me what are the ways to customize android widgets, can we do that using css, like we do for the HTML?
Thanks in advance...
There are a few ways. You can use 9patch to edit the files inside the SDK(which will typically be C:\Android\SDK\platforms\android-19\data\res\drawable-hdpi) - Android-19 is the api level, and then set them in your xml layout under the widget you want with
android:background="#drawable/your file"
Another way is to create a selector(Recommended because it can handle stuff like when clicked and more), shape(Simple creation with corners and stuff), layer list(Advanced selector) or solid(just a color) in /drawable and then set them in your xml under the widget you want with
android:background="#drawable/your file"
An example of the second solution can be found here android button selector

How do I customize the look & feel of a Gallery?

I'm having a hard time understanding how I can create my own Gallery item. Specifically, I want to alter the appearance of the rectangle that surrounds whatever is the currently selected item (and remove altogether the rectangle that surrounds the non selected items).
Is there a good tutorial on how to create my own styles and pass them into my Widgets?
[Edit]
When initializing my gallery I hand it this
R.styleable.GalleryTheme_android_galleryItemBackground
and
R.styleable.GalleryTheme
I'm sure if I could crack those open, I could then copy and alter into what I want.... but where does Android store these?
[/edit]
The contents of those themes can most likely be found some where in the source code of the Android Open Source Project. It'l probably be somewhere here in the resources folder
Ok... this thread answers the actual question:
Android Hello, Gallery tutorial -- "R.styleable cannot be resolved"
Hope it helps someone.

How to use inbuilt icons and template?

I'm trying to make a list that looks exactly like Sound setting in 2.3.4 as in this screenshot:
The problem is that I tried using TableRow and ended up like this:
------------------------------------------
Vibration >
------------------------------------------
Only when not in Silent Mode
------------------------------------------
instead of one large row as in the screenshot. What did I do wrong?
These inbuilt icons are nice (such as the ">" icon) - couldn't find on Google Image so I guess these icons are "inbuilt" in the Android OS. Is there any document we can refer about this? I'd like to use system text colours/background colours and these icons but don't know how to implement in the code.
This is a PreferenceActivity.
This link is good example of android preference. Using preference you don't need to make table layout and using detail button icon. Using preference this icon comes automatically.
The examples from this link and this link may help you.
it is Listview but it is customizable you have to make xml file which display this tow Textview and icon(in your words).
These inbuilt icons are nice (such as the ">" icon) - couldn't find on Google Image so I guess these icons are "inbuilt"
This is not a inbuilt icons but this is just image that set customarily.
Here are some links:
Official Developer Community
fentastic Sai geetha blog
josecgomez.com

Categories

Resources