I'm creating some custom remoteViews, In order to draw custom views and layouts to a bitmap as wide as the notification panel I need its exact width.
As every vendor changes the width of the notification panel and in most cases it will changes based on orientation, It's difficult to find a regular pattern on that.
Is there any way to get its width?
The pink part is pure remoteViews and the bottom part is an imageview which I draw my custom view to it, since I don't have the parent width, all the child views get crumble together.
The easiest way is to use LinearLayout with android:orientation="horizontal"
and android:layout_width="match_parent"
, and to put android:layout_weight="1"
and android:layout_width="0dp"
for every view in that layout. That means that every view in that layout will have same width. More about it you can read here.
UPDATE: In here it says that notification tray width is 478dp. So, try with that. Maybe some manufactures have different size, but this is good number to start with :).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With