Percent Relative Layout with Android Nougat - android

I used percent relative layout in my project. It working good under android 7.
But I tested with nougat. Its not working.
Waiting Your Helps.

As documentation says, after Oreo(maybe you are using the 26 SDK?) it's deprecated, you will need to use ConstraintLayout
https://developer.android.com/reference/android/support/percent/PercentRelativeLayout.html
Hope this helps

Related

ConstraintLayout doesn't match with the screen size

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.

Android Studio XML using marginRight with API 17

I have a RelativeLayout and I am using android:layout_marginEnd="170dp"
and Android Studio is telling me:
To support older version than API 17(project specifies 15) you should
also add
android:layout_marginRight="170dp"
It's not an error, it compiles correctly, but I don't understand this hint. Why should I use marginRight? Why not marginLeft?
Can anyone explain me the secret behind this?
I looked for other answers but I still didn't get it.
Thank you in advance.
android:layout_marginEnd was added in API 17 for better support for right-to-left languages. However, earlier versions of Android prior to API 17 don't recognize this tag, so your need to add android:layout_marginRight as well.

Android toolbar height difference

recently I started working with android toolbars.
I am testing on android version 4.4.4 and 5.1.1. I am facing that the toolbars height are different. I have been trying hard to find an answer with no luck. I can provide source code, if you need.
Thanks in advance and Happy Holidays!
I already recreated the project from scratch, so I can not provide source code. Maybe I forgot to add android:fitsSystemWindows="true" in my layout.xml.

Android Studio sometimes using the deprecated ''fill_parent'

I just downloaded Android Studio May 10, 2014 and started using the rich layout editor.
I noticed that when I would drag and drop a RelativeLayout, Android Studio would automatically use fill_parent for both the layout_width and the layout_height attributes.
Why does Android Studio not fill in the non-deprecated value, match_parent by default?
It has been filed as a bug but has not yet been confirmed. You can see the bug report here.
Because it's in alpha stage of development :)

Downgrade SDK and build target android

I'm almost done with my app, and, i admit i made a mistake. I set the min build target a 2.3.1 at the begining and now, i want to downgrade it to 2.1 at least. Everything looks fine except in xml files. i got this :
error: Error: String types not allowed (at 'layout_width' with value 'match_parent').
My question is quite simple : anyone know how can i fix that ? I don't think minSDK 7 refuses the "match parent", but maybe i'm wrong.
Thanks in advance ;)
Change match_parent to fill_parent.
Try to use fill_parent instead of match_parent.Hope this will work for you.match_parent is replaced by fill_parent for some higher version(Exact version from which it is deprecated I don't know).
I tried in sdk 2.1 and match_parent is not working but in Google API 2.1 sdk match_parent is working so you can change the sdk version to Google API 2.1 and then test if it is working in real device if yes then match_parent will works fine otherwise change the match_parent to fill_parent
hope it will help!!

Categories

Resources