Android Question ImageView

Sergey_New

Well-Known Member
Licensed User
Longtime User
I need to place two images male.png and female.png of size 24x24 one below the other in an ImageView of the corresponding size. If the ImageView does not allow this, is it possible to programmatically create a new one from these images?
 
Solution
If it is not possible, is it possible to programmatically create one image from two images?
Use B4XCanvas (example attached).

[Don't worry about unnecessary and unused stuff, the example was created from a project template. Only the B4XImageView, B4XCanvas and B4XRect are needed (and the two image files, of course)].

Johan Schoeman

Expert
Licensed User
Longtime User
Can you not put one imageview on top of the other and change visibility of either depending on which you you want to display? Else just reload the image of the imageview with the image you want to display.
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Need to get this image in one ImageView:

 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have 3 images I use in with a Toggle Button and save inside the TAG which one is showing.

When the use clicks on the toggle button I go from Either to Male to Female then back to Either

Not sure if this works for you

Which Sex:
    Private        sQA_Sex                            As ToggleButton

#Region Sex_CheckedChange
Private Sub sQA_Sex_CheckedChange(Checked As Boolean)
                                 
            If  sQA_Sex.Tag = cNamesDB.DEFINE_DB_WhichSex_Sex_Either Then
                sQA_Sex.Tag                = cNamesDB.DEFINE_DB_WhichSex_Sex_Male
                sQA_Sex.Background        = mSexState_Male_Female            
                mDDPlayers.SetDisplayInfo_Color(True, Colors.Blue)
            Else If sQA_Sex.Tag = cNamesDB.DEFINE_DB_WhichSex_Sex_Male Then
                    sQA_Sex.Tag            = cNamesDB.DEFINE_DB_WhichSex_Sex_Female
                    sQA_Sex.Background    = mSexState_Male_Female    
                    mDDPlayers.SetDisplayInfo_Color(True, Colors.RGB(255, 0, 255))
            Else
                    sQA_Sex.Tag            = cNamesDB.DEFINE_DB_WhichSex_Sex_Either
                    sQA_Sex.Background    = mSexState_Either_Male
                    mDDPlayers.SetDisplayInfo_Color(True, Colors.Black)
            End If
         
            Log("Sex is:" &sQA_Sex.Tag)
End Sub
#end Region
 

Attachments

  • sex_female.png
    1.7 KB · Views: 38
  • sex_male.png
    1.8 KB · Views: 38
  • sex_male_female.png
    3.9 KB · Views: 41
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Robert Valentino, thank you, but I have another task.
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
I asked if it was possible to place two images in one ImageView at the same time.
If it is not possible, is it possible to programmatically create one image from two images?
It seems that neither can be done.
Thanks to everyone for participating.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
If it is not possible, is it possible to programmatically create one image from two images?
Use B4XCanvas (example attached).

[Don't worry about unnecessary and unused stuff, the example was created from a project template. Only the B4XImageView, B4XCanvas and B4XRect are needed (and the two image files, of course)].
 

Attachments

  • TwoImages.zip
    65.3 KB · Views: 42
Last edited:
Upvote 0
Solution

Sergey_New

Well-Known Member
Licensed User
Longtime User
LucaMs, thank you very much! This is what I needed.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…