Android visual editor doesn't allow editing - android

Properties in the Outline-view are mostly in seemingly disabled state, while using Android visual editor. Only those properties, which already had some content when opening a layout-file are available for editing. Others might pop up some window when clicked, but even after selecting something nothing gets changed.
There doesn't seem to be anything meaningful to update via Android SDK Manager or among the Eclipse-plugins. I'm using Eclipse 3.7. What's wrong with the editor?
Android Visual editor properties http://hoito.org/kuvat/toisaanne/eclipse-androidvisualeditor-properties.png

If the property line has gray background (what you describe as "disabled"), it means that property has the "default" value set. In that case, no attribute entry is set in the xml.
If you select multiple elements, properties are shown gray if none of the elements has that property set, white and empty if the property is set by some but not all elements, and white with text when all selected elements have the same value. Note that multi-selection only works properly when you use the "sort alphabetically" button.
At times, the property editor can be a bit unwilling, but if you double click an entry shown in the popup, or press enter when selecting a proposed value, the property should be set.

Related

Old / dark dialog boxes when using TStyleBook

This problem is highly related to the following question: Why are all the dialogs are using the "old" Android 2.x style?
I'm using Delphi Berlin (10.1), where this problem has been fixed already:
But, as soon as a TStyleBook is dropped to the form and assigned to it (e. g. by right clicking a component and then "edit custom style"), the dialog boxes (all of them) turn to the dark style again:
The automatically created "trimmed" style is still the "light" version ("AndroidL Light"). And yes, I checked that function "GetNativeTheme()" in FMX.Helpers.Android.pas assigns the Result, I even copied the file and added it to the project. Removing the assignment from Form1.StyleBook show the native styled dialogs again.
How can this be solved while still keep using a TStyleBook?
I found the problem: Function GetNativeTheme() was searching with TStyleManager.FindStyleDescriptor() in the assigned style for a TStyleDescription object entry, to look if one of the strings "[LIGHTSTYLE]" or "[DARKSTYLE]" is used for the target platform. In a full style file this object entry is normally present, but when starting to edit a custom style of a component inside the IDE, a TStyleBook component is created with just a small style. It cannot be seen inside the IDE, but this small style does not contain the TStyleDescription object entry, so the dark/light theme can not be found out. And by default, the GetThemeFromDescriptor() returns 0, which seems to correspond to the dark/old style.
I solved the problem by double-clicking the TStyleBook component, save the style to a file (*.style), opened the file in a text editor and simply manually added the TStyleDescription object entry. Saved and loaded back to the IDE. Now all dialogs use the correct light style theme.
Here again as text:
object TStyleDescription
StyleName = 'Description'
Author = 'Embarcadero Technologies Inc.'
AuthorURL = 'www.embarcadero.com'
PlatformTarget = '[ANDROID][ANDROIDL][LIGHTSTYLE][DEFINEFONTSTYLES]'
MobilePlatform = True
Title = 'AndroidL Light'
Version = '1.0'
end
In addition to StanE's answer:
Instead of adding a StyleDescription to all custom styles you can also modify the GetThemeFromDescriptor() function in FMX.Helpers.Android to return a default value of TJAlertDialog.JavaClass.THEME_HOLO_LIGHT.

Default Values from strings.xml appear in Android Studio but not when I run the app

I'm following the Building your First App tutorial. I'm using Android Studio 2.3.1
I have default values in strings.xml. When I reference these in the design editor, they show up correctly in the design preview and the XML. However, when I run the app on a device, no text appears. There are no errors or warnings. I've tried multiple devices.
strings appearing correctly in the design editor
This happens because you are setting the string content in the tools text field (the one with the wrench on left). You have to set the string content in the empty field above.
If you set the string content with tools:text, it will apply only to preview layout.
If you set the string content with android:text it will apply both to preview and to rendered layout.
If you set both, the tools:text field will have more priority than android:text field on preview and the android:text field will be used for rendering.
Check those properties again.
You have the string in the text property with a wrench. If you look at the XML, you will see tools:text. That's a text property that you can only see in the preview (to test with dimensions and things like that, like you had real text on the component).
The real text one is android:text.

Meaning of android studio checkboxes in properties window layout editor

Just updated to latest version (2.2) and saw the checkboxes that you can check in the properties window. There is three different options to choose from which two is pretty self explanatory, the checkbox that is checked and the one with minus in it. But what does the blank one mean? I tried all three and didn't notice any difference between the blank and minus. Probably not only specific to android studio but first time I se it.
It might be a bit late for an answer, but I've just had the same question while playing around with Android Studio. The meaning of the three states of the check boxes for boolean properties can be found by looking at the text view of the layout xml-file:
checked -> property set "true"
blank -> property set "false"
minus symbol -> property unused, will not appear in the xml-file

Android Studio Change Occurrence Color

How can I change the occurrence/write occurrence color in Android Studio? Is this even possible? In Eclipse it was found (on a Mac) under Preferences->General->Editors->Text Editors->Annotations
Does Android Studio even provide this option? It's a number of small annoyances like this (as well as the massive performance issues it seems to be having thus far) that prevent me from moving to Android Studio.
Currently running Android Studio 1.2 Beta if that helps.
Go to menu
Preferences > Editor > Color&Fonts > General
Find "Identifier under caret" and change Foregound or/and Background colors with a color you wish. When you click a variable, it will be highlighted with the color you chose.
To mark selected occurrences in Android Studio you have to additionally use a shortcut
Ctrl+Alt+Shift+J
to mark them. Then all occurrences will be highlighted with darker better to see color. That option is also available in menu
Edit -> Find -> Select All Occurrences
Still if you want to change that color then you can find it in
File -> Settings -> Editor -> Colors & Fonts -> General -> Selection background
If you are using default scheme then you will have to save a new scheme to change selection background color.
Sadly I didn't find any option to change the color of selected occurrence after selecting class/variable (one click, like in Eclipse). I guess that there is no option for that yet.

Accessing Android Studio properties window?

I have recently started using Android Studio and cannot work out how to access the properties window.
The following screenshot was taken from Google and shows exactly what I'm trying to access denoted by the red rectangle around the properties window.
Can anyone please tell me how I can access this?
Switch to design view. Click "Design" tab at bottom-left work area.
In the new Android Studio Version 3.1.2, the name of the Propierties Windows is "Attributes".
Look at this picture:
Attributes basic view
And, if you want to see the complete attributes, simply click on "View all attributes":
Attributes full view
How to restore windows?:
restore windows
I had the same issue than found that the properties window was always there but I had to drag it out with my mouse. Just go to the far right vertical bar in Design mode then drag to the right when your mouse turns into horizontal arrows pointing away from each other. Hope this helps!
You can just click on the design tab on your screen (at the left bottom corner below your code text window) and just click on anything whose property you want to change
make sure you are in the '.xml' file
I accidentally deleted the properties side bar and Window-->restore deafult layout helped.
Follow the doc.
Instead of editing your view properties in XML, you can do so from the Properties window (on the right side of the Layout Editor). This window is available only when the design editor is open, so be sure you've selected the Design tab at the bottom of the window.
When you select a view, the Properties window shows the following, as indicated in figure 5:
View inspector with controls for width/height style, margins, and bias (available only for views in a ConstraintLayout). For more information, see Build a Responsive UI with ConstraintLayout.
This happens all the time, to my opinion Android team should see as an improvement opportunity, here is the solution, click on the settings (gear symbol) on the right make sure that the attached side is set to None. also -See screen shot-> 1,
You have three ways to see the fields, design mode, split mode and code mode. THE ONLY ONE THAT shows the Attribute bar is on the SPLIT MODE, click on the Attribute see screenshot->
if that does not work, you can go to Windows -> Restore default Layout
if that still does not work you can do File -> Manage IDE Settings -> Restore Default Settings.
if that still does not work you can go in file explorer and delete the .android studio folder in C\users[your user].Androidstudio#.#
Hope this helps someone out there...

Categories

Resources