Android Example ImageView - Circular, Hexagonal, Triangular, Bubble, Star Imageviews (with inline Java code)

Mahares

Well Known Member
Licensed User
@Johan Schoeman: Excellent example. I added some silly code to your project:
B4X:
Sub ImageView1_Click
    Msgbox("I am a parrot trapped in a Triangle.","")
End Sub
Sub ImageView2_Click
    Msgbox("I am a parrot trapped in a Hexagon.","")
End Sub
Sub ImageView3_Click
    Msgbox("I am a parrot trapped in a Circle.","")
End Sub
Vive l' Afrique
 

Johan Schoeman

Expert
Licensed User
BubbleBitmap.png
BubbleBitmap_alone.png
...and last but not least, adding the ability to display bitmap images in a "bubble/droplet" ImageView. From here on you can add more methods to create various/different shapes of imageviews by drawing the required path. Perhaps a bit of maths and trigonometry will be required to do some special shapes - but should be relatively easy to do so.
Take note of the line in method
public static Bitmap getBubbleBitmap(Bitmap scaleBitmapImage) {
...
....
path.addArc(oval, 0, 270); //in degrees!

Here 0 degrees is measured from to the right most point of the x-axis and 270 is the top most point of the y-axis. The arc is drawn CLOCKWISE form the starting point (0 degrees) to the end point (270 degrees).
 

Attachments

Last edited:

Johan Schoeman

Expert
Licensed User
StarBitmap.png


Added the ability to display the bitmap within the Imageview as a star. Use the spinner to select the number of "points" that the star should have (spinner ranges from 4 to 50). Also added a cone shape:
bm2 = nativeMe.RunMethod("getConeBitmap",Array(bm))
 

Attachments

Last edited:

achtrade

Active Member
Licensed User
I'm getting this error: Unknown member: InitializeContext

in this instruction :

nativeMe.InitializeContext
 

klaus

Expert
Licensed User
Do you have JavaObject files in the AdditionalLibraries folder ?
Check if you have the JavaObject are in the Library folder of B4A.
Then remove the JavaObject files in the AdditionalLibraries folder.
 

achtrade

Active Member
Licensed User
Do you have JavaObject files in the AdditionalLibraries folder ?
Check if you have the JavaObject are in the Library folder of B4A.
Then remove the JavaObject files in the AdditionalLibraries folder.
JavaObject files are in Libraries, date 4/30/2014, I don't have AddiontalLibraries
 
Top