I am working on an instant app demo app. I used the default template which I extended with a RecyclerView and a custom adapter. My problem is that my layout is totally broken:
As you see the toolbar is the same, but something does not work correctly regarding the coordinator layout. The floating action button is missing and the navigation drawer is not displayed below the system UI (the notification area) and yep of cause the menu is empty.
The both screens are debug builds so proguard is not messing anything up (I got also release working with proguard, but of cause I still have the same issue). On the left is the result of the gradle task :app:assembleDebug and on the right :instantapp:assembleDebug.
Since I use except of the recycler view the default template for this app I add no code, any idea why my layout is broken in instant apps?
Please follow these steps and you should be good to go!
https://developer.android.com/topic/instant-apps/getting-started/first-instant-app.html
Note : Please select Navigation Drawer Activity in Step 8
From the shared image, it looks like you have modified some code from the default Navigation Drawer Activity for your IA. If yes, please share the code to investigate.
Also, let me know the device/emulator and the Android studio you are using. I was not able to reproduce the issue with Studio version 3.0.1 on Nexus 5x (Android version 8.0.1). Following is the image of the instant app from my nexus 5x with 8.0.1 build. Let me know if I am missing something!
Related
At developer.android.com I found a tutorial called "Build a simple user interface". Unfortunately, it is based on an older version of Android Studio. It tells the user to open activity_main.xml. If one does this, the user cannot find the right icons in the toolbar. I searched and someone said open content_main.xml instead. This indeed posts the right icons in the toolbar, but as one continues in the tutorial, more and more errors appear. My question is: Is there a newer Android Studio User Interface tutorial that is appropriate for the latest Android Studio, version 3.6.1?
I really want to learn how to build interfaces via Android Studio and not clumsily play directly with XML code. Thanks for any ideas!
--Steve
so I'm trying out Android Studio for the first time, and I've already run into something. I'm following the official "first application" tutorial on developer.android.com, but it's not matching up. So, I tested this with two apps, and it wasn't like a bug in the first one exclusively, it happened in both. Here's a pic of an app where nothing has been changed and I followed the tutorial exactly:
As you can see in the hierarchy, it is supposed to have the Hello World text that displays when you make a new app. However, with me not changing anything, it's not showing up.
Any ideas?
Also to clarify, the items do show up when I run it on my device, it just doesn't show up on the computer.
Check the upper right corner of the Preview screen, you should see a red warning mark. Click on that and it will tell what is preventing Android Studio from rendering your layout.
Some times android studio stuck or something.Try doing
File->Invalidate Caches/Restart
The best solution is
Clean Project
Rebuild Project
In your style.xml file change the string parent with the below line:
parent="Base.Theme.AppCompat.Light.DarkActionBar"
I'd like to add a lock widget to my application but I am unable to find one.
The android 4.4 alarm clock for example has one. Or the android lock screen. Are there similar components available as widgets which can be dragged into a layout in eclipse?
The widget is called GlowPad and is part of the Android 4.4.4 AlarmClock.
I ended up using net.frakbot.glowpadbackport.GlowPadView.java, which is available at github.
I've ignored the readme.md, the gradlew (which is some kind of non-working makefile) and all the crap that came with it[1]. Instead I've created an android project from scratch with scr.frakbot/*, an empty AndroidManifest , values/attrs.xml and lib/nineoldandroids-2.4.0.jar and it. And it worked out of the box.
[1] Don't get me wrong, gradle is a nice software, but why should I care creating a gradle.local, a keystore from keystore.example (!) and all that, if I can simply drop the 9 necessary files into eclipse?
This is the error I'm getting in my layout XML files:
error!
NotFoundException: null
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- TextView (Change to android.widget.TextView, Fix Build Path, Edit XML)
This happened after updating my SDK tools in Eclipse. However, I can still compile my code, I just can't see the graphical part of my layout.
Recently, I also added the RootTools library, could that also be the cause?
Thank you!
I had the same problem. And it turned out to be a very strange thing.
In my strings.xml file I had a line
<string name="email_seperator_char">\#</string>
And this was causing the problem. Even if I use the escape character for # sign preview was not working after SDK update.
SOLUTION:
I just added a space in front of it and voila, it worked.
<string name="email_seperator_char"> \#</string>
I know it is strange and it may not be acceptable for some apps to have an space infront of it. But that was ok for my app. Hope this helps.
And in design mode, in graphical layout, you have a new icon, (android icon), click and select 8 minimum.
I'm not sure it helps in your case, but I found out what was the problem with mine. To support older Android devices, I lowered my project build target to API level 7 (Android 2.1) from the previous value of API Level 8 (Android 2.2).
There might be an issue with the 2.1 layout renderer, it kept crashing on my TextView's property android:textAppearance="?android:attr/textAppearanceMedium". Even when I removed it, rendering was working but had a strange appearance (grey background, tiny black text). Switching the API level back fixed the layout editor straight away.
To change it, go to your project properties, select Android on the right, then tick the box next to your desired API level under Project Build Target.
I ve got the same issue just a minutes ago, try to lower the API level, press the andorid green icon in the layout editor screen and on the dropdown menu select API 7. I think it would be work out.
I've been having similar issues. After reading a number of these posts, I've found that there is probably a bug in the layout renderer for Android 4.0.3. An error message is listed (ROOT
Exception details are logged in Window > Show View > Error Log) even when all parts of the project are set to Android 4.0.3 and SDK 15.
If I set the layout renderer to Android 2.2 and leave everything else set to Android 4.0.3, SDK 15, then it all appears to work just fine.
I hope this is useful.
there is something wrong in your TextView
one time I wrote this which cause the problem
android:textAppearance="#android:attr/textAppearanceLarge"
the Eclipse can`t tell that is wrong but the design view crashes,when I realized that,I change # to ?
android:textAppearance="?android:attr/textAppearanceLarge"
then all comes to normal
I am trying to use the rather smart ActionBarSherlock and it is going ok except for 1 rather important thing. The app icon seems to be firmly stuck in the middle of the actionbar.
I am currently deploying on 2.3.4, not using actionbar tabs and using the theme
android:theme="#style/Theme.Sherlock"
Everything works fine except for this. I have also tried it on the emulator.
Any suggestions?
Solved I was stupidly not telling Eclipse that I was designing using android 3.2 or higher.
This messed up the appearance of the actionbar when built.
I also found it essential to build the sherlock library from the downloaded zip file outside my workspace.