An Android App development beginner here. I created a simple app which converts KMs to Miles and vice versa. Issue seems to be with the interface. The interface for activity_main.xml is as below:
Interface on Android Studio compiler
But once I emulate it on an Nexus 6 API 29 emulator, it looks weird and doesn't work properly. Tried it on a Nexus 5 emulator as well, same issue. Here's a screenshot:
Nexus 6 API 29 Emulator
Moreover, when I tried installing the apk file on my Samsung Note 8, it doesn't install, even after changing the settings and allowing unknown apps to be installed. Please help.
Judging from first screenshot (red alert icons in "Component Tree" window) the issue is the fact that You did't constrained Your Views.
When using ConstraintLayout You can't just 'place' views in editor, they need to be constrained to something in order to be displayed in desired place.
For example: Your button with text "Convert miles to kms" should be constrained as follows:
left to parent left
right to parent right
top to EditText above it or to TextView "KMs".
But other views need to also be constrained to get desired behavior.
You can read about ConstraintLayout and how to use it in this tutorial from official documentation: https://developer.android.com/training/constraint-layout
Related
I struggled a lot with this, and i'v searched a lot also but found nothing.
I am using VS 2017 to develop a Xamarin.Android app, with the minimum SDK version of Android 5.0 (API Level 21) and a target SDK version of Android 8.1 (API Level 27).
In the app, i am using the Arabic language, and i faced 2 problems :
The first one is that in the designer view, i can't get the direction of the layout to be RTL(Right to left), when i added the property : android:layoutDirection="rtl", it worked only when i run the app on my physical device, but in the designer i can't get it to be RTL, i tried even changing setting in the toolbar in the designer view here :
The second one is that the arabic text value is being show as squares as also shown in the picture above.
I have tried rebuilding but also no chance, anyone have an idea or a solution for what's happening?
I'm currently working with Xamarin for developing an android app. The structure of the app is really simple yet but a big problem appeared concerning the rendering of my main page. First, it's important to know that I'm supposed to develop for target API 23 so Android 6.0.
And every time I test my application on my Android 6.0 device via USB-debugging the design is totally messed up with my only (!) button duplicated many times and the textViews mixed up over the screen (As shown in the picture link below).
Even though I am new to Xamarin and Android (and C#) I have my settings (as I think) in perfect order. The minimum API level is 21, the target SDK version 23 (Android 6.0), my device runs version 6.0.1, the target compiling framework in properties is set to 6.0, the manifest is set up as I mentioned before and even my "Designer" window with the layouts .axml is set to v23.
I really don't know what to try next, because I want to start coding further. Would be nice if sb could help me out with that.
I have already tested the code of the app on a different API level (26 I think) and it worked perfectly fine with my Galaxy S9 in Debugger mode. Everything looked like it was designed in first place.
I also tried different AppThemes in Visual Studio but not one of the 7-8 I tried worked in any way different except for the colors.
The android app does only switch when clicking the button, texthttps://imgur.com/i0xChVniew 2 into the current date and time. I'm really sure, that my code is not the problem.
Picture: How it should look (In Xamarin)
Picture: How it looks on the phone
I'm wondering why in every tutorial I watch the preview section looks like this: i.e it has the actual device shown as preview and has a button for linking it to an activity
When mine looks like this: for some reason doesn't have the device
I'm sure I've just not installed something correctly or not clicked a checkbox, or a version of something is wrong but after some googling i can't seem to work out what it is. Any help would be greatly appreciated.
Newer versions of Android Studio do not show the device bezel by default. Everything looks installed correctly.
Look at the Android Studio window title.
Your video is using 2.0 Beta, and your newer version just doesn't have the bezel.
You'll also notice there's different buttons around the screen preview area.
You could disable it in older versions, I'm not sure if it's completely gone but it was probably removed because it took up screen space and didn't serve much purpose
Hi I was using Google API level 7 for my App.
I coded all layouts in dip unit. Now I installed Google API 8, changed my project to use level 8.
But, after launching the App, getting modified view. For e.g- the length increased for a list-view. Also, service call is not working. Restarting eclipse didn't solve the issue.
Then again switched back to Google API 7, now the service calls working fine. But, having layout issues like- font-size got bigger and list-view having increased height.
so, is there anything am missing? or why the layout is changing in different API Level! I don't have a device; will all the element measurements change in device?
which layout are you use? if linear layout then no problem because when you check it on device it will get in proper manner.now you got problem of size of emulator so click on avd > click on avd item(Google api 8) > click edit button > set built in : HVGA >edit AVD > then run
dont worry check it in device it will get properly.
I'm new to Android programming, and i'm building a small test program.
My problem is that in the graphical layout of the .xml files the widgets(Spinners,Buttons...) looks nice and round, but when I put my program into my phone(Nexus S, if that matters) or in the emolator, they come out with rounded edges,making the whole program look really ugly.
Is theres something i'm doing wrong?
Thanks!
The problem is that you have set the build target to 2.2 or earlier and Nexus S is running 2.3, which has redesigned UI elements. If you set build target to 2.3 it sould show the same (not rounded) buttons and other elements in the Eclipse XML viewer as they are in the Nexus S.
I believe the Nexus S doesn't use the default android theme. Many of the standard UI items (radio buttons, buttons, check boxes etc) will have a different look than the UI builder will show.
Edit: wait...its showing up different in the emulator too?? my answer may not apply in that case, sorry :-\
So the unrounded buttons are the new ones? Isn't that stupid? The are uglier.
And I set the build target to 1.6, and both the emulator and the nexus s are running 2.3,so that explains it.
Does anyone has a guide that explains how to change the UI items to nicer ones?