If you go to: Android Studio -> Preferences -> Editor -> Code Style -> Java/Groovy/XML you find Default Scheme.
Or on MacOS: /Users/raiym/Library/Preferences/AndroidStudio3.1/codestyles/Default.xml
Where it comes from? Couldn't find which style guide Android Studio follows.
I've done quite a lot of researches, but in the end, I haven't reached a very satisfying answer: probably it's just a code style for IntelliJ.
The first thing I did was trying to compare the IntelliJ style with something else, but I always found some differences.
It doesn't follow Google's style because they don't fully qualify import, in fact, IntelliJ will try to unify imports by putting *, like writing import foo.*; instead of import foo.Bar;.
It doesn't follow Oracle's guidelines either since the switch statement is formatted in a different way:
switch (condition) {
case IDEA:
statements;
break;
case ORACLE:
statements;
break;
}
At this point, I've started looking for something else, but found even less. In fact, IntelliJ doesn't tell about the code style used in their software anywhere. Instead, they just explain how to change it.
Moreover, there are plugins for every possible code style! If one of them was the actual style in IDEA a plugin shouldn't be needed...
To make things worse, even for Kotlin, a language created by IntelliJ, they differentiate between "Kotlin Coding Conventions" and "IntelliJ IDEA default code style".
What I think is that they made a code style that works for most languages supported by their IDEs with little differences, and this is what Android Studio ended up using by default.
Android Studio code styles are based on IntelliJ Idea code styles. You can refer this link to know more about code styles in IntelliJ Idea
Code Style Java
Also you can refer this link to customise your code styles,
Android Studio Code Style
Related
In web development, I see how tags have default themes defined in the browser, and I see how they're applied.
However, with Android Studio's themes, I'm really confused. I can define my custom themes using ?attr/myClass, apply it on widgets by android:theme="?attr/yClass", and then assign a colour to that attribute in my day or night theme files.
But, what baffles me, is—that purple. Where does it come from? When I set the theme header to
<style name="Theme.TestingThemes" parent="Theme.MaterialComponents.DayNight.NoActionBar">
purples come for the not night mode.
When I use other styles that come with "default" with Android Studio, I don't see exactly that purple.
Some themes allow me to set my own colours, but some others don't, like the one that I mentioned.
Worst of all that totally blows my mind is: when I open the theme files in app/res/values/themes/* and app/res/values/colors.xml*, I only see less than 10 themes defined. Yet I see Android Studio suggesting to me a long list of colour names! Where do these come from?
I only use Vim as my text editor. I'm drowning in Android studio. It's cool and powerful, but I require some baby-walking assistance.
A default new project created in Android Studio has a colors.xml resource provided in the project (res/values/colors.xml), where the purple_500 and purple_700 you described are defined.
Any other colors and themes you see that aren't in your own project's files are in the AppCompat and Material Components libraries (defined as project dependencies in default new projects), or they're built into Android itself.
In the Projects panel on the left in Android Studio, if you expand External Libraries, you can see all the code libraries that are imported for your project as dependencies (these are defined in app/build.gradle and downloaded from the Web automatically). Among these dependencies are AppCompat and possibly the Material Components libraries, with their own provided resources within.
You can't modify the contents of the libraries. You're intended to customize by extending (making child styles and themes).
If you want to see where a reference is defined in Android Studio (in XML or other languages like Kotlin and Java), you can Ctrl+Click and it will jump to the line that defines it in whatever file it's in.
I've been developing with Android for a year and have honestly never bothered using material buttons.
You can create your own drawable file for the background of the button and then add that drawable to the back of a regular button in a layout. Don't let things like this frustrate you; there are so many ways of achieving the same outcome in Android :D
I'm new in xamarin and I wanted to put my TabbedPage in the bottom in Xaml by using this tutorial:
https://learn.microsoft.com/fr-fr/xamarin/xamarin-forms/platform/android/tabbedpage-toolbar-placement-color
Then, when it didn't work, I tried to rebuild the project like suggested in this stackoverflow question:
Where can I find ToolbarPlacement attribute of TabbedPage?
I saw some people using a old nugget package, but I don't really want to use it, especially if there is a native way of doing it.
Xamarin forms version : 4.1.0.555618
Android version : 9
I hope there is someone that have the same problem as me,
Thank you in advance,
halonico,
Setting the placement and color of the toolbar on a TabbedPage, you just add the following code:
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:TabbedPage.BarItemColor="#666666"
android:TabbedPage.BarSelectedItemColor="Red"
android:TabbedPage.ToolbarPlacement="Bottom"
Although there are still many mistakes, you don't meed to worry about these, you try to clean your project, then build your project directly, you will see it works fine.
In Android studio there is two option for code folding. one is Editor fold tag (<editor-fold desc="Description">) and one is region comment (//region Description).
I used both for code folding, but never understand what is a different between both?
The difference is in style. <editor-fold..> provides NetBeans folding style and region..endregion provides VisualStudio folding style.
Note:
You can only choose one of the style for a particular file. No mixing should be done.
What i want to do:
Create a custom keyboard, since default keyboards are not sufficient.
Keys needed: 0-9, '-', ',', 'e', 'del' and one empty one where i can put the logo.
I already achieved this in iOS with inputAccessoryView, but after some research i believe there is nothing similar in android. So i decided to go the way of creating my own Keyboard in xml.
Tested Source is from here.
But the XML Designer in Android Studio tells me: The following classes could not be found:
Keyboard (Fix Build Path)
Row (Fix Build Path)
Tip: Try to build the project.
I have no clue what this error is about, and stated tips by android studio aren't doing anything.Any help is appreciated!
EDIT: Ok, to make it clear: Android Studio doesn't know the xml tag "< Keyboard >". Why? Do i need some sort of special import in the manifest file? or sth in the gradle files?
EDIT 2: To make it really clear what happens to be my problem here:
It is possible to do a custom keyboard!
The Keyboard design must be in res/xml/qwerty.xml.
I would recommend you to follow this tutorial, where it is explained how to do it from scratch.
Good luck and hope it helps! :)
Where can I find the source code of the definition of the android default styles, such as ?android:attr/progressBarStyle?
I know that the Android repo is replicated in https://github.com/android but... I just can't find the styles.xml, strings.xml, etc there!
In the value resources directory.
With the ADT plugin in Eclipse, you can just type android.R.somegroup.someconstant, then mouse-over and hold CTRL (doesn't even have to be syntactically correct/compilable for that) -- this will give you a popup with two (or in case of strings.xml more) options to "Open declaration in [some XML file]".
For reasons that escape me, this doesn't seem to work for any of android.R.style.* -- for everything else it does (color, string, layout, ...).