Android Studio 3.5.1 layout issues - android

Every TextView, Button and control that I drop into the blueprint view goes to the upper left corner. I have seen demos that show people dropping controls in and they all go in right below the previous control and it allows them to be resized, center, or any other setting applied. I have been able to adjust properties of each control to make them visible, but I have to do it in the text mode of the XML file. I'm new to android dev so I don't know all of the properties for the controls yet. This doesn't seem to work for me. Is there a default setting that needs changed to allow controls to be placed where I put them??This is extremely frustrating.

Related

Set background for FMX popup window

I have an FMX Android project compiled with Delphi 10.1 Berlin. The user needs to select from 19 values to run it and I use a TPopupBox component to display 19 TRadioButtons that show in 3 columns of 7+7+5 buttons for that selection.
The default is for a transparent popup window which is useless, so I edited the style to add a white TRectangle to the background of the popup window which works, but only if I size the rectangle to match the size of the popup. Aligning the rectangle to client or contents only sets an opaque background to the first row of radio buttons. I have 2 questions:
How can I auto size the rectangle rather than fixing it at design time to match what I calculate will be set for popup.bounds?
Is adding a TRectangle to the style background the best way to get an opaque control?
I have tried all obvious align options and searched the internet. Somebody suggested deleting 'background' from the style list but that did not work. Somebody else suggested editing the manifest but my manifest just gets overwritten when I compile.
I believe you wrote erroneously TPopupBox and probably meant to write TPopup. That is anyway what you should use for popup windows.
You may want to create a new project, for testing purposes. Add a button near top left. This will show and hide the popup window.
Add a TPopup and size it as you wish, and set Visible := True.
Add a rectangle inside the popup and set its Align property to Contents. Set its Fill.Color property as you wish. Add TRadiobuttons as you wish, on the rectangle.
Finally, the code to toggle the popup visibility (but see notes in Help):
Popup1.IsOpen := not Popup1.IsOpen;
Please note! There are many properties that jointly affect the placement of the TPopup: Placement, PlacementRectangle, PlacementTarget. As I don't know your needs, I leave it to you to decide what to use.
A sample test case:
Here PlacementTarget is Button1 and Placement is Bottom.

Android 10: 3-button navigation is obscuring bottom of the screen

I have had feedback from Pixel 3/4 users that the bottom of the screen on this app is cut off, obscuring buttons and possibly other controls that the user requires.
This has only started happening on Android 10. The app contains both Xamarin.Android axml and Xamarin.Forms xaml layouts for the views (the particular page that you are viewing below is Xamarin.Forms).
I don't want to set margins, paddings, gravity or such like on the entire app as obviously that would impact non Android 10/Pixel users. I don't really want to check the operating system version and programatically change those properties as that seems quite hacky and will quickly become unmanageable.
I've looked for something similar to a UseSafeArea property for navigation bars rather than notches but there doesn't seem to be any. Is using WindowInsets the only way to this or has someone else had/solved this issue?
How it looks (controls at bottom are obscured):
How it should look (and does on every other device, the data is different here but it's the view that matters):
I had a similar issue which I solved by removing a few lines of code that were there to fix a bug that has since been fixed in Xamarin Forms.
It directly relates to this forum topic: https://forums.xamarin.com/discussion/87176/windowsoftinputmode-doesnt-work-in-xamarin-forms-android
If these lines exist in your MainActivity.cs, try removing them and see if that works:
Window.SetSoftInputMode(Android.Views.SoftInput.AdjustResize);
Window.SetSoftInputMode(SoftInput.StateHidden);
AndroidBug5497WorkaroundForXamarinAndroid.assistActivity(this);

ConstrainLayout editor adding unnecessary constraints or margin making it impossible to use

I really like the constraintLayout but I'm forced to use it in Text mode since the Design mode is completely buggy.
When I try to add constraints directly onscreen it justs messes up the layout entirely, creating fixed margins and unnecessary constraints. The worst part is that sometimes it looks like the constraints are well applied in Design mode (the layout seems correct), but when I switch back to Text mode, it adds completely random constraints and it's really frustrating.
I'm using Android Studio 2.3.3 which is the latest Release version
Is there a way to fix this ?
I usually do all the dragging inside blueprint mode, then edit/add/remove any extra constraints inside the 'Properties' drawer on the right side of Android Studio. You can click on the blue dots to delete, edit the margins manually, and set vertical/horizontal bias.

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...

Tips at start-up or update

I have an update for my app that includes ActionBarSherlock with a sliding menu. I have put my navigation entirely in to the sliding menu, leaving my main_activity pretty bare. I am worried the user won't know about the menu. So I want to add a prompt at start-up that will highlight the new feature. Like this:
I am not even sure what this is called, so I don't know how to research it. Any help or suggestions will be rewarded. Thanks!
You could just use overlay layout (Frame layout with multiple inner layouts will fit perfectly. Please note Frame Layout Z axis is by the lower the layout is in the xml, so the guide should be the last in the XML). Make that layout's background mostly transparent and add buttons and design to fit your needs. When you don't want to show the layout just set visibility to gone. And when you need it set to visible.

Categories

Resources