-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create a 2x2 sized widget with a width and height of 1:1, occupying the screen side by side #31
Comments
It can be seen that the width of each of the two widgets above is the maximum value, and the height is equal to the width; I don't know how many dp minWidth should be set to achieve such a layout. |
not work… |
Can you share the code for your widget?
You can only use If you want your widget to be a square, you can use
You can also read https://developer.android.com/develop/ui/views/appwidgets/layouts for deciding on the |
What launcher are you using, and what version of the library are you using? |
real phone: "react": "18.2.0", #22 as if our problem is the same |
It is not centered because But you are right, this looks like one of the previous issues. The problem is that we cannot render React Native views directly to the widget. What this library does is render the React Native views to an image, and showing that image in the widget. When using some launchers, the reported and actual size are not the same... I haven't found a reliable way to get the exact size, the current behavior is to crop the widget if the reported size is smaller. Can you try with Nova Launcher and see if the widget works? |
I checked some information, android cannot directly obtain the actual size of the widget on the screen, nor can it obtain the component size of The size of the widget is limited by the screen grid, so the actual size may not be equal to the set |
Can the |
No, the parameters are mandatory. See my previous comment about why (#31 (comment)). |
I've documented this behavior in https://saleksovski.github.io/react-native-android-widget/docs/limitations, and opened a new issue #34 to track it |
I don't mind the widget being a bit smaller than the actual grid but somehow while using a ListView the content seems to exceed the width of the background rectangle (image attached) I'm not sure how I could make this background extend a little bit in height so that the content doesn't flow out, I think this would make the widget a bit more useful for someone using this particular launcher. I'm testing the widget on the default launcher on OneUI 3.1 (Android 11). Thank you for your help! |
You can try setting background color to the list item. |
May I ask? The following two are generated by me, and I want them to be the same as the above two, with the width occupied side by side and the height equal to the width. A normal phone should have two in one row, but if it is a tablet, there may be more than two in one row.
The text was updated successfully, but these errors were encountered: