Android Question CustomLayoutLibrary, how to get a completely custom layout?

ema01

Member
Licensed User
Longtime User
Hi,

in the iOS version of an application i was able to make a dialog that was really customized, using the iCustomDialog library.
Now, i wanted to mantain the same look and feel between the iOS and the Android version of the application.

this is one of the dialogs i want to replicate:


And this is how far i've got:


So, i'm almost there.

Changing the background color happened in two steps:
- changing the pnlDialog background (pnlDialog is the one declared in Dialog_Ready)
- changing the pnlButtons background. pnlButtons is the panel which is the parent of the buttons.

To get to pnlButtons is easy
B4X:
Dim btn As Button
btn = dialog.GetButton(DialogResponse.CANCEL)
If btn.IsInitialized Then
  Dim pnlButtons As B4XView = btn.parent
End If

btn can also be used to change the appereance of the buttons. Text, Typeface, TextSize, TextColor, Background, Height.
However, no matter what i tried, i couldn't change the distance between the button and the bottom.

I then tried to operate on pnlButtons but nothing i tried worked.
I noticed that if i only changed the CANCEL button height the view that contained them was scrollable, so i tried to cast it to a ScrollView, but as soon as i tried changing one parameter i got this error

B4X:
java.lang.ClassCastException: com.android.internal.widget.ButtonBarLayout cannot be cast to android.widget.ScrollView

so this is a ButtonBarLayout... How can i change its properties?

Furthermore, i would like to be able to change the dialog view directly, for two reasons.
- I'd like it to have the corners more rounded
- For another dialog-like window it would be interesting to have it semi-transparent. I think that with iOS i just have to change the alpha of the dialog, but in android.. no idea.

By the way, i tried to get to the dialog view by referencing to the parent of the parent of .. i went five levels deep hoping to get something, hit the activity or at least a null reference, but nope. I really got 5 parent views..
Tested by changing the color of each one to different colors and then backwards to transparent :/

Maybe at this point i should just add a panel and mimic a dialog.. i don't know..

Thanks for all who can help me..
 

ema01

Member
Licensed User
Longtime User
I think so..
it's just a matter to call CloseDialog with the appropriate value anyway.

Thanks Erel
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…