Cableguy Expert Licensed User Longtime User Aug 9, 2024 #1 Hi guys and gals, I found this article that "claims" to be able to get a view's rounded corner radius... which would be useful to get the screen's rounded corner radius by means of root Rounded corner APIsAndroid 12 introduces RoundedCorner and WindowInsets.getRoundedCorner(int position), which provide the radius and center point for rounded corners. Click to expand... How can I implement this in B4A?
Hi guys and gals, I found this article that "claims" to be able to get a view's rounded corner radius... which would be useful to get the screen's rounded corner radius by means of root Rounded corner APIsAndroid 12 introduces RoundedCorner and WindowInsets.getRoundedCorner(int position), which provide the radius and center point for rounded corners. Click to expand... How can I implement this in B4A?
Solution Erel Aug 11, 2024 Code: Copy Private Sub GetActivityWindowInsets As JavaObject Dim ctxt As JavaObject ctxt.InitializeContext Return ctxt.RunMethodJO("getWindow", Null).RunMethodJO("getDecorView", Null).RunMethod("getRootWindowInsets", Null) End Sub Code: Copy For position = 0 To 3 Dim RoundedCorner As JavaObject = insets.RunMethod("getRoundedCorner", Array(position)) Log(RoundedCorner) Next
Code: Copy Private Sub GetActivityWindowInsets As JavaObject Dim ctxt As JavaObject ctxt.InitializeContext Return ctxt.RunMethodJO("getWindow", Null).RunMethodJO("getDecorView", Null).RunMethod("getRootWindowInsets", Null) End Sub Code: Copy For position = 0 To 3 Dim RoundedCorner As JavaObject = insets.RunMethod("getRoundedCorner", Array(position)) Log(RoundedCorner) Next
Erel B4X founder Staff member Licensed User Longtime User Aug 11, 2024 #2 Code: Copy Private Sub GetActivityWindowInsets As JavaObject Dim ctxt As JavaObject ctxt.InitializeContext Return ctxt.RunMethodJO("getWindow", Null).RunMethodJO("getDecorView", Null).RunMethod("getRootWindowInsets", Null) End Sub Code: Copy For position = 0 To 3 Dim RoundedCorner As JavaObject = insets.RunMethod("getRoundedCorner", Array(position)) Log(RoundedCorner) Next Upvote 0 Solution
Code: Copy Private Sub GetActivityWindowInsets As JavaObject Dim ctxt As JavaObject ctxt.InitializeContext Return ctxt.RunMethodJO("getWindow", Null).RunMethodJO("getDecorView", Null).RunMethod("getRootWindowInsets", Null) End Sub Code: Copy For position = 0 To 3 Dim RoundedCorner As JavaObject = insets.RunMethod("getRoundedCorner", Array(position)) Log(RoundedCorner) Next