Constraint line is not working in design view - android

Please click on this link for the image:
Second image for new project:
Please see Image above. I have added many button/view to the layout. But there is no constraint line/ alignment line that I used to see when I add new items to the layout. Also, I don't see my view/button show up in the design view.
What is wrong? How can I fix this. So, I can design my layout quickly in the design view?
One note, when I create the first app project. I suppose to see the word "Hello world" in the middle, but I didn't see it this time also

Clean and rebuild your project then you will be able to see it, the problem occurred because your code contained some error when it was building so building failed and android studio don't show preview if that happens.
Cleaning and rebuilding will solve your problem

Related

Problem migrating to Jetpack Compose. Trying to run the app from within Android Studio generates a wierd error

I've an application that uses Fragmnent Views with XML resources and I want to migrate it to Compose. Being the app quite big, I decided to temporarily have a mixed environment with Compose working together with the old XML resources, so I created a new Compose fragment and I succeeded to add the standard navigation action to navigate to it. The code builds successfully, but when I try to run the app I get the error of the picture below. It is particularly wierd because this error appears immediately, and not in the build panel, but in a popup dialog. Any hint ?
Ok, the documentation is not very clear, but in the end I found this:
"You can also include a ComposeView directly in a fragment if your full screen is built with Compose, which lets you avoid using an XML layout file entirely."
Being my app a hybrid one with XML navigation graphs, it looks like I need to define an XML resource anyway.
I hoped I cound avoid defining an XML layout, but it seems I need one for a fragment that has an old fashioned Activity as parent.
I'll post an update as soon as I discover something new
UPDATE
Adding an XML layout didn't fix the problem.
In fact the XML layout is not necessary. I don't really understand the cause of that error, but after cleaning a couple of times the project and clearing A.S. cache it disappeared. I succeeded to add a Compose Fragment to an old XML resources style app. The old navigation works without problems. Hope this post will help someone else save the time I have wasted...

Android Studio can't add elements to the layout

I'm trying to create my first app in Android Studio with Kotlin. The installation worked fine. However if I drag any element onto the Layout, it's not showing up properly. The only change I can see, is a little white dot, that appears as soon as the Layout contains any element. I can select it and view the element attributes on the right, but nothing more.
If I run the app, all elements are squashed in the top left corner.
I already reinstalled Android Studio.
Does anyone know how to fix my problem?
Thaks in advance!
Here is some more information:
XML Code,
Error messages
Make the constraint layout width and height as match_parent in text editor. and then try adding widgets in the design view.
Here is some more information:
XML Code,
Error messages

Android how to remove gridlayout from the project?

I added grid layout to my project at the start and eclipse added a bunch of stuff. Now, though I am not using this layout. I want to remove it.
I can see the following from my properties file:
target=android-18
android.library.reference.1=../gridlayout_v7
When I remove the line
android.library.reference.1=../gridlayout_v7
I get compile errors relating to my R.java class.
I cannot seem to find a proper way to remove this package. Anybody knows how to do this?
Thanks!
#Nightshadow please right click on project and select properties and then select android now you will able to see Library pane in below area from there you can remove grideview layout library

setting my main project default to linear instead of relative

Everytime I follow a tutorial book or you tube video, I have also used the cheat help in eclipse. My programming always comes out with errors. here is one example why does all the tutorials main activity comes out showing linear layout and my projects default is relative layout. So how do I change the default to linear when creating new project.
I know I can open a new layout xml but all the tutorials opens a new project in linear.
I am a massive fan of android and I really want to make some apps, but all the tutorials never seem to correspond with the results I get and they all make it look so easy.
go to youre layout.xml
make sure to be in the graphical layout (check bottom bar)
top-right in 'outline' right-click on the relative layout
choose 'change layout'
choose youre desired layout, (linearlayout(vertical) probably in ur case)
I found it after digging a lot in Android Studio After visiting JetBrains and Intelij documentation and help sections i found nothing much helpful but i found way on my own, I had answered it here, With all explanation and screenshots.

Unable to drag UI elements to Android layout Eclipse

I am having trouble getting Eclipse 4.2 to work with the latest Android SDK. When I try to drag any of the UI elements from the palette onto the Graphical Layout of the XML, or onto the outline view, nothing happens. Same is true when I try to drag existing elements in a relative layout. I am able to use the XML for the layout but not the designer.
I am also not able to close tabs using the x icon, I have to right click then go to close.
I have tried using Eclipse 3.7, same problem.
Thanks in advance for the help.
The emulator might be running. Try closing the emulator and drag ....it should work !
Hello I am assume that into your XML file, You can not see the graphical layout.
I have also face the same problem when I import the project from the workspace, that time simply close the project and again open the project.It works for me.
And for more Information see this LINK
Finally solved by re-downloading eclipse
Check your XML for warnings displayed as little yellow exclamation marks like this one:
Although my code was running fine this prevents any drag and drop.
Try cleaning the project and run it again. this worked for me.

Categories

Resources