ConstraintLayout doesn't match with the screen size - android

I just started my first Android Studio project and I already come with a problem :)
I search on google for the answer but didn't find my problem.
So I need your help please ^^
I download the last version of Android Studio, create a project with an Empty Activity and I came up with this
As you can see my ConstraintLayout is really small and I just can't work with this.
I didn't touch anything on the project. Just to be sure I create 3 projects that have the same issue and redownload 4 time Android Studio.
On the virtual Devices, it looks correct throw: Screenshot
I put the XML code just in case it can help
xmlcode
Hope I was clear and sorry for my English ;)
EDIT: For some reason, the constraint layout fit correctly on the watch screen, but I don't want to create a watch app x) screenshot_watchview

Ok so I have finally find the problem ! I'm so happy right now :D
The problem was the AppTheme theme that I use, I switch it with the DeviceDefault theme. I don't know why this theme was causing problem but now it work and I can finally work on my first Android App !

If you are using the supportLibrary 28+ then this thing happened to me too.
and when I change the support lib version to the 27, it works.
Maybe this is a possible bug in the support library 28+.
Changing the AppTheme works like a charm if you want to stick with the support library 28+ But if you still don't want to so Try using the support library below 28.

Related

Android text and design

All the videos I watch have a text and design tab, but mine doesn't.
I found this on the internet:
Base.Theme.AppCompat.Light.DarkActionBar
but it didn't work on mine
how can I fix it?
you can switch tab mode using those buttons
"split" view is a relatively new feature to Android Studio. You can read a little about it
here.
You may be using an older version of Android Studio. Be sure that you install the latest version for this feature to be enabled.
Base.Theme.AppCompat.Light.DarkActionBar is related to your app's styling, not the IDE. It isn't really relevant here.
enter image description hereits 3.6.2 i just download it today

Android Studio - TextView not showing in design view layout

I am brand new to trying out an android app. I started to follow the online tutorial (https://developer.android.com/training/basics/firstapp/building-ui), but getting a bit frustrated at adding a new TextView, as according to the tutorial, it should show in design view, and let me move it around. It is invisible to me in design view though, and I can only see it by running an emulation. Please can someone let me know if I am doing something wrong? or something the tutorial does not tell you? or is this just a bug?
Thank you in advance for any advice you can offer.
There is a bug in latest sdk 28 ,
Change the compileSdkVersion 27
targetSdkVersion 27
and
implementation 'com.android.support:appcompat-v7:27.1.1'
Update:
This is said to fix problem but I did not test it yet
In styles.xml change the parent theme for your app to Base.Theme.AppCompat instead of Theme.AppCompat
I faced this issue too, this is a issue from the latest support.appCompact.
Inside gradle dependencies if your using,
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
change to
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
This will fix the issue
You see it in the component tree so, if you want to modify or delete it, you can do that from there.
First and foremost, check to see if your dependencies match your SDK level. To check this, go to your app.gradle file and check every highlighted statement for version conflicts.
If this doesn't work, your next debugging step should be to restart your Android studio. Since the view shows in your component tree (and in your emulator), it ought to show in your preview. Previews in android studio lag sometimes due to various reasons (mostly machine related).
If it still doesn't show up after restarting, the problem might be a larger scale IDE issue and you should consider updating your question accordingly.
I hope this helps.. Merry coding!!
Found an easier way than adding code or changing SDK. It is just hidden and you have to show it by checking the "Show layout Decorations"
Hope it helps.
P.S. it also solves the hidden toolbar problem Picture of where to find it

android material design issue

i am trying to solve a issue for last 1 week. i am not sure what is wrong with the code.
i am trying to use this library https://github.com/rudsonlive/NavigationDrawer-MaterialDesign
I can able to compile and run the code
the issue is ,there is big difference in the display quality
clearly we can notice the font is completely not matching.
please help me to resolve this.
You should use Android Design Support Library to achieve this.
It's quite easier and will surely fix your problem.
Check this official sample to learn how to use this:
https://github.com/chrisbanes/cheesesquare
Omg i cannot believe it. the actual problem with me is eclipse.
I use android design support library and all other needed libraries.
i only can manage to run the project but when i imported the project using android studio everything is working fine without any additional work.
dam it.
any one tired with eclipse ?

I can't see the graphical layout when I open an XML file

It shows a blank screen. I then have to click the blue/gray star icon and choose App theme, only then will elements show in the palette. I then have to drag an element from the palette onto the blank screen and drop it. Then the graphical layout will appear.
It used to work fine until I started playing around with themes and ActionbarSherlock.
I tried restoring defaults on all Android and XML settings but it didnt work.
Does anyone know how to fix it so that the XML graphical editor shows up when I open a layout XML file?
(The xml I am working with are not blank.)
Every day i face this problem, especially when I add a new Andorid Project to workspace, the only solution I found is to restart Eclipse, I hope this will help you too.
I guess your issue is Eclipse related, but try to be specific next time about your IDE since it may help you get the right answer.
If you're using Eclipse i recommend that you check that your Android SDK Tools Eclipse plug-in (ADT) is up to date.
This happens with me sometimes if I haven't chosen an android version in the top-right corner of the graphical layout editor. Because the same theme might look different in different versions of Android, I guess eclipse doesn't know what to show you unless you select a specific version of android for the theme you have chosen.
It also sometimes happens with me, If I have used a Google API's version instead of Android X.X version as target build for my project. Maybe some bug in the developer tools.
Try to increase -Xms128m -Xmx1024m when launch eclipse. I had the same problem because i don't have enough memory.
Hope this helps.
Ok, so my best understanding is that you somehow overwrote or changed the default theme for that project with something other than AppTheme. You should be able to change that in the styles xml file (ProjectPath/res/values/styles.xml), assuming this is the same project.
For reference, mine works fine, and my project's styles.xml looks like this (new project):
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
</resources>
In the eclipse, right click on your XML file and choose Open With and then XML Editor
At the bottom of the page, you'll see Design and Source tabs. Click on the Source to see what you desired.
mine never refreshes. So i open up another file then return back and then it refreshes. Even if i go to the palette to refresh it was not working. Also like others mentioned make sure your your api version is application to what you want rendered. So mine was set to api 20 but my project runs on api 17 so play with it. Heres a image:
notice how mines set to 17 - yours might be at 20 or something else that differs from your manifest. change it accordingly.
Solution for andoird Studio Users.
Below solution worked for me.
File --> Invalidate Caches and Restart --> Invalidate and Restart.
Hope this will work for you too.

Blank Graphical Layout?

I don't get this. I've searched everywhere and no one's answers have solved this for me.
Why does this keep happening? I can't do anything! The XML Code is still there, but it doesn't show anything in the Graphical Editor. The Palette comes up if I change it to "4in WVGA (Nexus S)" or some other configuration, but I still can't see anything and the Theme drop down menu is unselectable. All my XML documents are like that.
Just delete any custom device screen configuration you have added . It will solve the issue :)
That just happen to me and after some attempts I found the reason.
When I first opened the project in eclipse I found some errors related with the version of Java. I changed the JDK compliance to 1.6 (Project->Properties->Java Compiler) and all errors dissapear but all graphical layouts went blank.
I uncheked "Enable project specific settings" (Project->Properties->Java Compiler) and now all the graphical layouts are working.
When everything fails, close eclipse and start it all over again, it solved my problem.
I also had that problem, it happened to me when i imported my project. after some time I came to reason just change the workspace of eclipse to folder, which contains your folder.
I changed workspace on opening eclipse, there can be some other way as well
hope this will solve it
If it has never worked for you (or something went wrong upgrading your SDK, as in my case), you may need to install an extra package. For me the issue was fixed when I installed Android Native Development Tools under NDK Plugins (SDK version 20).
I had this problem since I switched the option Show previews in the palette. I switched to show only icons, everything is ok now.

Categories

Resources