I created a custom notification with standard height (not the expanded version described with bigContentView) which works fine with Android 4 up to 6.
In Android 7 the design of the notifications was changed, the third line which used to be at the bottom is now at the top, and the notifications are higher than before. But for unknown reason my custom notification is not enlarged accordingly and now looks like a foreign object between the other notifications.
I am using android:layout_height="match_parent" and also experimented with fixed height, but without success.
Is there a way in Android 7 to let my notifications look great again, or is there a bug in that OS version?
The picture the link points to shows three notifications. The first and last ones are 99 pixels high, while my custom notification is 85 pixels high.
Custom Notification
I was having a problem with my notification layout on Android 7. Setting the parent with fixed height such as 64dp and having its childen's height set to match parent was resulting in a weird UI with empty spaces on the top and bottom. I resolved it by setting the children's height to 64dp instead of match_parent. Hope this helps.
Related
I have this screen in my React Native app: https://snack.expo.io/#gkeenley/playful-blueberries
It renders fine in that snack ^^ for web (the default emulator), but for Android the image gets a height of zero and doesn't appear.
Does anyone know how I can approach debugging this?
UPDATE
If I remove flex: 1 on the icon style, it fixes it. But I don't understand why that makes a difference and why you need to do it for Android but not web.
There have description in document about "Flex Dimensions" and notice.
A component can only expand to fill available space if its parent has dimensions greater than 0. If a parent does not have either a fixed width and height or flex, the parent will have dimensions of 0 and the flex children will not be visible.
I have this ratingbar which is inside the applications and it is always displaying correctly.
But recently I realise that it is not working correctly on some devices (which include Nexus 5 with Lollipop version). The rating bar are covered by a black overlay as shown on the image below (only on some devices). When listview (with rating stars) is scrolled, the rating bar will be shown (and then black overlay shows again). it only affect the yellow stars but not the white ones.
I am not sure if anyone had ever met this problem before? I am thinking if it is the recent android update on Nexus 5 that causes this as the rating bar works well on other devices.
Accoring to me,
This may be using v21 of the support libraries or possibly unstable OS update as .xml file and code is not available.
These are the issue reported on google for rating bar please check link below,
RatingBar rendering broken on devices
The development team has fixed the issue that you have reported and it
will be available in a future build.
RatingBar w/ Custom Stars Drawable is rendered as 1 stretched star on pre-Lollipop phones
when using v21 of the support libraries, the RatingBar w/ custom stars
renders as expected. With v22, instead of 5 stars, you just get one,
but stretched to match the width that 5 stars should take
First of all, do not use RatingBar#setProgressDrawable because no
matter what platform, it is going to work like #setBackground()
(single stretched image for whole background). Secondly, setting
android:ratingBarStyle on theme level does not work. I ended up
creating custom style, with "android:progressDrawable" and applying it
for every view I needed.
RatingBar does not render in InfoWindow
setting the style to android:attr/ratingBarStyle does not work, and
ratingBarStyleSmall does work
I am trying to design a custom 'BigView' or 'expanded view' as per Android 4.1 design guidelines. As I understand the small/normal notification has a height of 64dp, keeping that in mind, I was wondering if there are any guidelines which state that the expanded view needs to be in multiples of 64dp/1U or can any height be used for the notifications (upto a maximum of 4U)?
I'm asking this question because it makes sense to have expanded notifications that are 2,3 or 4x the size of the basic notification and not just some random value (which might vary from app to app)
Nope. Can be any size you want between 64 and 256dp. BigTextStyle, for example, wraps its content TextView, so its height varies based on the amount of text you stuff in there.
According to Notifications, the maximum height of the Big notification content is 256dp.
The height available for a custom notification layout depends on the notification view. Normal view layouts are limited to 64 dp, and expanded view layouts are limited to 256 dp.
I have a RelativeLayout whose size takes up all screen area that is available to the containing Activity. That is, it fills all screen area except for the notification bar.
I am using ActionBarSherlock. The ActionBar is set to overlay mode using getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY). Therefore, the height of my RelativeLayout spans from immediately below the notification bar right down to the bottom of the screen, and any child Views it holds could potentially be placed behind the ActionBar. The ActionBar is therefore definitely operating in overlay mode. I confirm this is the case on devices running 2.2, 4.0.x(ICS) and 4.1(JB).
Because my application implements a drag-and-drop mechanism within this RelativeLayout, I need to know the layout's position on the screen so that I can correct the absolute screen Y touch values returned by getRawY(). To achieve this, after the layout phase has been done, I have been calling mRelativeLayout.getLocationOnScreen() inside of onWindowFocusChanged().
On my 4.0 and 4.1 devices, the call to getLocationOnScreen() produced a Y value that matched the height, in pixels, of the very top notification bar. In order to determine the height of the notification bar and ActionBar combined, I would add the Y value returned by getLocationOnScreen() to the result of ActionBarSherlock's getHeight() method.
The problem is that when testing on a 2.2 device, getLocationOnScreen() is returning a Y value that is already the notification bar height plus the ABS height. This is the case even though the ABS is set to overlay mode.
There are a few questions on SO regarding implausable results from getLocationOnScreen(); the one here has an answer which gives me the idea to just abandon getLocationOnScreen() and instead calculate the RelativeLayout's top Y offset by subtracting the layout's height from the total screen height:
DisplayMetrics dm = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(dm);
int mRelativeLayoutYOffs = dm.heightPixels - mRelativeLayout.getMeasuredHeight();
What I find bizarre about the result of this though is that it seems to give me the same inconsistency as I get from getLocationOnScreen(). What happens on 2.2 is that the call to .getMeasuredHeight() on the RelativeLayout actually seems to be giving a height value that has the ActionBar height subtracted from the actual height of the RelativeLayout, even though the ABS is set to overlay and that I have visually confirmed it is definitely in overlay mode.
The best strategy I can think of doing at the moment is to just treat the result of getLocationOnScreen() differently depending on the operating system version. If it's 2.2, then I know it includes the ABS height. If 4.0 onwards, it doesn't. Anything between 2.2 and 4.0, I'm not yet sure. Perhaps people can help fill those details in. Perhaps the difference is introduced in OS versions that support the ActionBar natively? If it is predictable and well defined what the behaviour is, then hopefully this would be a safe strategy.
Failing that, are there any suggestions for other means of determining the RelativeLayout's top and left screen positions in order to correct the absolute screen touch values?
The problem was because I should not have been using getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY). Intead, my custom style (which inherits from a parent ActionBarSherlock theme) needed to contain:
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
Furthermore, I was wrong in saying that on 2.2 the ABS was working in overlay mode - in fact, it wasn't. Now that I'm using the above style items, it is now working in overlay mode in 2.2.
.getLocationOnScreen() is now correctly returning a Y value that only represents the notification bar height on my 2.2, 4.0 and 4.1 devices.
I'm trying to lay out elements for a user profile using the appcelerator api. On iOS it automatically sets the height so all of the text is shown. The same code in android seems to cut off the bottom of the text, and I have to set a static height for it all to appear. I feel that this is somewhat backwards. Has anyone else had a similar problem?
If you set the height to "auto" for the parent element, it should be just fine. In both Android and iOS.
And of course, the height for the label needs to be also "auto". Make sure to use quotes though, it doesn't know the variable auto