How should you work with Themes in Android? - java

I have been practising my skills with android (Kotlin), and I am having issues with styling the UI, with most solutions here not working. It feels like there's some default style overriding what I am trying to achieve because often than not the changes are visible in the layout creator GUI in android studio but not in the app itself. I even noticed the apps base dark or light theme setting affects the Ui looks which should not be the case for me.
The greatest challenge I have had is trying to change the app theme with both methods not working or working only to a certain degree which often leaves things quite off:
toggling using this AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES)
or explicitly changing the theme using setTheme(R.style.Theme_Dark)
Is there something I am not considering or I do not know? I am happy to provide any more information for better context. Thanks in advance!

So I have done a little more reading and seen some of the underlining issues I was experiencing. I'll be updating this are I learn more.
I have learned of a feature called Force Dark introduced in Android 10 which automatically intelligently inverts the colours of the screen ignoring elements such as images and icons vectors in order to create a dark theme before the view is rendered.
Adding this line in more Theme xml file prevented this giving me more freedom.
<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>
(27-6-2022)

Related

How do I modify default android auto activity bar

I am trying to figure out how can I modify the icons and interchange the order that appear in android auto navigation activity.
So far I have found this code needs to be modified directly in AOSP. The file that I think that is drawing this is CarNavigationBarController.java
I have not been able to figure out the resource that I need to modify the icons and their order.
Thank you in advance.
You can't.
This bar is generated by Google's Android Auto application and it's proprietary.
The Android Auto playback menu is standard, and the third party apps are not allowed to change the interface
You can only customize the color of the button, to distinguish your brand for some degree. Otherwise, the experience should be consistent and predictable to minimize the drivers distraction.

Android Studio automatically changes button style. Why?

I just developed an app on Android Studio and I used normal default grey button of kitkat. But some time later I made a copy of that app (to make another project) and now in this copied app, new buttons as well as those old buttons are shown with some different style. I am confused as to where I got that new style. It looks cool but I don't want to lose it as automatically as I got it.
I am attaching an image, this will show the changes in design.
Either you are using Theme.Material or Theme.AppCompat, or something that inherits from those (e.g., Theme.AppCompat.Light), as the basis for your app's theme. Or, you have no theme, and you are running on an Android 5.0+ device, and so you get Theme.Material by default.
Both Theme.Material and Theme.AppCompat (the latter in conjunction with AppCompatActivity and the rest of the appcompat-v7 library) aim to implement the Material Design aesthetic, and Material Design says that button captions are in all caps.
add this line in style
<item name="android:textAllCaps">false</item>

Android specific UI

I would like to make a system of page on android 3.0 a little bit special.
Here is a plan of the management of the pages that I would like to have:
http://imageshack.us/photo/my-images/814/schemau.jpg/
It would be a question of making as for the management of the notification on the desktop.
I thought of the slideDraw but at the moment it is little decisive.
Have you an idea of which component to use and how?
You can use FrameLayout and simple View Animation, this is what comes to my mind. Place three layouts on top of each other using FrameLayout, then animate them as you like on touch event. Hope this helps.

App not working on certain phones

People have been experiemcing a problem with my android app. Apperently what is happening is on phones such as the Droid x and cliq cupcake have been experiencing the main menu not showing the letters on the buttons and in some occasions it will cause a force close in certain sections. My buttons do have picture backgrounds if that could be the cause and the app is set for version 1.6. Not sure if either has anything to do with it. If anyone has experienced it or has any ideas I would appreciate some help. Thanks alot
It should work on every phone if you read this post carefully
http://developer.android.com/guide/practices/screens_support.html
In best practices part recommended list is here.
Use wrap_content, fill_parent, or the dp unit (instead of px), when specifying dimensions in an XML layout file
Do not use AbsoluteLayout
Do not use hard coded pixel values in your code
Use density and/or resolution specific resources
Every android developer should read that post to support for multiple screens.
Hope this helps

Tools for rapid layout/interface creations?

Does anyone know of any tools (besides DroidDraw) that can help me create the basics of my projects a bit quicker? I'm looking for something that will allow me to very quickly generate the XML for my layouts so I don't have to sit there typing like a robot for so long.
Thanks!
However the drag and drop layout design method is not recommended for Android Applications UI designers but there is an Open Source project on Google Code: android-ui-utils , in which you might find something intersiting.
It uses a Firefox addon Pencil to draw and design android layouts and also uses an online "Android Assets Studio" where you can design your custom Icons like:
Launcher icons
List item icons
Menu Icons
Notification icons
You can give up a try here:
http://code.google.com/p/android-ui-utils/
DroidDraw is OK, but the reality is that if you are going to write for Android you are going to want to learn how to write XML layouts from scratch. I remember that XML layouts seemed bizarre when I first started working with the Android SDK, but eventually it starts to make sense.
I read a blog post from a member of the Android team at Google explaining why XML layouts are better than GUI-based layout systems (such as the one included with the iPhone SDK). I can't find the link right now, but basically XML allows for layouts that gracefully scale across devices of radically different sizes and purposes where a GUI-based layout designer often has to be tweaked at best and redone at worst for devices of different sizes.
The official Android Plugin for Eclipse comes with a GUI Editor which supports drag'n'drop of GUI Elements. Not necessarily better than DroidDraw, but maybe you didn't know yet: http://developer.android.com/sdk/eclipse-adt.html

Categories