I have made an app using target sdk version 2.2 ,but for newer version I need to implement the same app on android 4.0 .But when i tested on the device it shows small layouts.
I have some questions:
1.Why is it showing small layouts ?
2.How I can change it?
3.Will there be any other problem related to this when I switch to android 4.0.?
Please answer these questions?
For change layout
In your xml editor .there is combobox for resizing layout check
that.
For Change version
Right click on your current project > properties >android > select
version >ok
no problem for changing
If you are using Eclipse, you can change the Android target version quite easily. Project->Properties and then select Android and change the target version (Note: You may need to use the Android SDK manager to install new targets and AVDs).
You shouldn't have any problem going from 2.2 to 4.0 although again you may need a new AVD or device to test your app with.
Not sure what you mean about small layouts...
Layout:
Your layout is probably set to a specific screen size or density. To support multiple screens, create a layout folder under res. You can create layout folders for specific screen sizes and densities. Something like this:
layout
layout_ldpi
layout_mdpi
layout_hdpi
For more info, check this link
Related
This week I updated Android Studio till 4.0 version.
Its new LayoutInspector certainly has many useful features, it's great!
but in previous versions of Android Studio i had the opportunity to open a few tabs of different screens using layout inspector.
Does anybody know how to do it in Android Studio 4.0?
Because now in version 4.0 LayoutIspector has another view in separate window and no any tabs.
Thank you very much!
Finally i've figured out my problem.
In fact Live Layout Inspector of version 4.0 provides complete information about app's UI structure and hierarchy for emulator/device with API level 29 or higher.
But if you need the previous version's view of Layout Inspector, then you just have to disable Live Layout Inspector:
File -> Settings -> Experimental, and check the box next to Disable Live Layout Inspector.
I already made the layout.xml in the layout folder, but for a small device its not working
than = then =x
and after reading some articles, i must create a layout-small isnt it?
so im trying to do in android studio, it dont allow me saying that it already exist, BUT there is not layout-small folder =/ i should i do?
EDIT*
i already tried to create a folder manually in windows and restart android studio, not working too...
what i saw is that while gradle is building, i show all the folders, but after gradle finishes, it HIDE the folder
Look:
WHILE BUILDING:
AFTER BUILDING:
It may be a little bit stupid, but did you try creating this folder manually using Windows? If it is already, maybe restart Android Studio?
Also Screen Support
Note: Beginning with Android 3.2 (API level 13), these size groups are deprecated in favor of a new technique for managing screen sizes based on the available screen width. If you're developing for Android 3.2 and greater, see Declaring Tablet Layouts for Android 3.2 for more information.
i am trying to make a alarm clock, the GlowPadView in the newer android versions it quite good looking and i was planning to use that in my application, but at the same time i also want to support 2.3.3(Gingerbread) which still has a major chunk of phones. So i was wondering if there is a way that i can check the android version the phone is running and show the layout according to that. If the phone is running API 11 + the layout shows GlowPadView otherwise it shows basic swipe views from the Gingerbread stock alarm application.
To check the android version Build.VERSION_CODES can be used
android.os.Build.VERSION.SDK_INT;
So i was wondering if there is a way that i can check the android version the phone is running and show the layout according to that.
Create separate directories, such as res/layout/ and res/layout-v11/. Have the same-named layout resource in each (e.g., foo.xml), and put the GlowPadView in the foo.xml that you place in res/layout-v11/.
As you stated, you could just create two completely separate layouts, and then have an if (android.os.Build.VERSION.SDK_INT > 11), setContentView() to one layout and if (android.os.Build.VERSION.SDK_INT<=11) setContentView() to a different layout.
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
Well, lately i've been coding an app using 2.3 emulator, I was mainly testing the app in 2.3.7 phone, but yesterday I updated my phone to android 4.0.3 and the UI looks like shit, in fact, keeps the "bad" looking 2.3 UI.
Now i'm trying to get a nice looking app in both versions of android, the problem is that i don't want to have 2 separate projects an edit both of them, so i want to use one single project and 2 virtual machines for the different versions.
The problem is that if i create a project destinated to 2.3 i can't call to HOLO Theme resources, and if I create a 4.0.3 project it will not even work in android 2.3 right?
so... what do i need to do?
thanks.
You need to set the targetSDKVersion as 15, minSDKVersion as 10.
You need to create various resource folders for these two versions. Example, create a folder 'values-v14' inside 'res' folder and define your widget styles for ICS. Have another folder 'values-v10' and keep your styles for 2.3.3
If required, use the version qualifiers to define separate layout for different versions.
The below links will give you more clear idea.
http://developer.android.com/training/basics/supporting-devices/platforms.html
http://developer.android.com/training/backward-compatible-ui/index.html