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

Parrots.png
See attached project with inline Java code to create round imageviews. You only need library JavaObject V2.01 to be enabled.
 

Attachments

  • RoundBitmap.zip
    57.1 KB · Views: 2,414
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
TriangleBitmap.png


The attached project adds the ability to display bitmap images in a triangular ImageView
 

Attachments

  • TriangleBitmap.zip
    57.5 KB · Views: 921
Last edited:

Mahares

Expert
Licensed User
Longtime 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
Longtime 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

  • BubbleBitmap.zip
    57.6 KB · Views: 994
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime 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

  • StarBitmap.zip
    58.3 KB · Views: 878
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
HeartBitmap.png


Displaying the bitmap within the Imageview as a heart and also a star with a circle around it...just for fun.
 

Attachments

  • BubbleBitmap2.zip
    58.8 KB · Views: 897
Last edited:

achtrade

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

in this instruction :

nativeMe.InitializeContext
 

achtrade

Active Member
Licensed User
Longtime 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
 

Johan Schoeman

Expert
Licensed User
Longtime User
I put everything in the Libraries folder. is that wrong ?
Here is the JavaObject V2.01 files. Try them and see what happens
 

Attachments

  • JavaObject.zip
    10.2 KB · Views: 698
Top