Android Question Changing properties of snackbar

hi all, i want to change my snackbar color , its text color , size and font. because in my manifest file , (text color) is setted black and on an snackbar with this color is not very obvious:
photo_2021-12-14_18-51-03.jpg

could you help me please.
 
Solution
Yes. as you and DonManfred said , it is very good idea. i will write a class for it and if there is not any bug in , i will send to community. but now , problem is that how i can set an animation for panel?(except SetLayoutAnimated method)
as i tried , its possible with Animation and AnimationPlus library. if your target isnt very very advanced animations.
Probably be better to post your code....
there is not many codes in project...
i changed the (textcolor) proeprty of theme in Manifest and wrote codes that showes snackbar. anyhow it is similar to following codes....
in manifest i added these :
Manifest:
SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
   
        <item name="colorPrimary">#2196F3</item> <!-- action bar -->
        <item name="colorPrimaryDark">#1976D2</item>  <!-- status bar -->
        <item name="colorAccent">#FFC107</item> <!-- checkboxes. switches. msgbox buttons in Android 6.x -->
       <item name="android:textColorPrimary">#FFFFFF</item> <!-- msgbox and actionbar text in Android 6.x -->
       <item name="android:textColorSecondary">#BBDEFB</item> <!-- inactive editText line checkboxes scrollbar -->
       <item name="android:textColor">#000000</item> <!-- menu text. msgbox title -->
'       <item name="android:textColorLink">#b71c1c</item>
       <item name="android:textColorHighlight">#BBDEFB</item> <!-- selected text color -->
       <item name="android:navigationBarColor">#FFC107</item> <!-- navigationbar color -->
     
       <item name="windowNoTitle">true</item> <!-- This codes are for removing defult actionbar in the activities -->
        <item name="windowActionBar">false</item>
       <item name="windowActionModeOverlay">true</item>
     
    </style>
</resources>
)

and in main activity :
Main:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("L1")
    Dim Snk As DSSnackbar
    Snk.Initialize("snk",Activity,"YOUT TEXT HERE...!",5000)
    Snk.SetAction("HELLO")
    Snk.Show
End Sub


of coures the image that i attached in prior post has an scrollview that show some buttons. but these casese havent any relevance as you know
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
BTW: Is it not possible to "emulate" such a function with a simple panel anchored to the bottom? I mean using B4X and no Library at all.
A Panel should be easily adaptable to look like a Snackbar. And you have full control over the full layout, colors, fonts...
 
Upvote 0
BTW: Is it not possible to "emulate" such a function with a simple panel anchored to the bottom? I mean using B4X and no Library at all.
A Panel should be easily adaptable to look like a Snackbar. And you have full control over the full layout, colors, fonts...
Aaaaa...
its very good idea. but i like that my visual elements have animation. is there any way to add Panel in layout with animation except SetLayoutAnimated method?
thanks for your help.
 
Upvote 0

udg

Expert
Licensed User
Longtime User
I'm totally with DonManfred. Why use such an old component? Write yourself a modern one and make it available to the community..
BTW, I searched for the definition of Snackbar..
"Snackbars are shown on the bottom of the screen and contain text with an optional single action. They automatically time out after the given time length by animating off the screen. In addition, users can swipe them away before the timeout."
A panel and its Toch event gives you what you need for the swiping. A timer will help with the timeout feature. Then two labels, one for message and one for the "action".

Edit: having already a timer..let's you design any kind of animation.
 
Upvote 0
I'm totally with DonManfred. Why use such an old component? Write yourself a modern one and make it available to the community..
BTW, I searched for the definition of Snackbar..
"Snackbars are shown on the bottom of the screen and contain text with an optional single action. They automatically time out after the given time length by animating off the screen. In addition, users can swipe them away before the timeout."
A panel and its Toch event gives you what you need for the swiping. A timer will help with the timeout feature. Then two labels, one for message and one for the "action".

Edit: having already a timer..let's you design any kind of animation.
Yes. as you and DonManfred said , it is very good idea. i will write a class for it and if there is not any bug in , i will send to community. but now , problem is that how i can set an animation for panel?(except SetLayoutAnimated method)
 
Upvote 0
Yes. as you and DonManfred said , it is very good idea. i will write a class for it and if there is not any bug in , i will send to community. but now , problem is that how i can set an animation for panel?(except SetLayoutAnimated method)
as i tried , its possible with Animation and AnimationPlus library. if your target isnt very very advanced animations.
 
Upvote 0
Solution
Top