CustomView -> Botão com imagem no topo e texto na parte de baixo

STIV RAEL GIACON

Member
Licensed User
Ola eu precisava criar um componente parecido com este abaixo

B4X:
+=================+
|   PANEL         |        
|   +===========+ |
|   |           | |          
|   | imageview | |        
|   |           | |              
|   +===========+ |
|   +===========+ |
|   | LABEL     | |
|   +===========+ |
+=================+

A ideia seria isso ser um botão com capacidade para carregar uma imagem e um texto abaixo e que eu pudesse mudar a cor de fundo, cor do rotulo etc.

Sou iniciante na linguagem B4A já peguei alguns componentes de exemplo no forum mas não consegui deslanchar no desenvolvimento.

Alguém poderia me ajudar... Muito obrigado
 

MaxRosa

Member
Licensed User
Longtime User
Há vários tipos de botões desse tipo aqui no fórum como IconButton ou FancyButton. Dá uma pesquisada que você encontra as bibliotecas.
 

STIV RAEL GIACON

Member
Licensed User
Max Rosa estou enfrentando este erro no FancyButton o projeto de exemplo do site funciona perfeitamente bem porem quando tento colocar o botao no meu projeto acontece esse erro:

B4X:
Error occurred on line: 34 (Main)
java.lang.RuntimeException: Font asset not found robotoregular.ttf
    at android.graphics.Typeface.createFromAsset(Typeface.java:276)
    at com.div.FancyButton.<init>(FancyButton.java:80)
    at de.donmanfred.FancyBtn._initialize(FancyBtn.java:166)
    at de.donmanfred.FancyBtn.Initialize(FancyBtn.java:51)
    at b4a.example.main._activity_create(main.java:395)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:735)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:7406)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
** Activity (main) Resume **

Eu já copiei o arquivo robotoregular.ttf para a pasta Files porem não funciona de forma alguma

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim fb1 As FancyBtn
    Private Label1 As Label
    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")
    fb1.Initialize("fb","\uf082",0,1, True)
    Activity.AddView(fb1, 0,0dip,100dip,100dip)
    fb1.TextSize = 30
    fb1.Radius = 50dip
    fb1.Text = "FB"
End Sub

Você já enfrentou este problema?
 

STIV RAEL GIACON

Member
Licensed User
Deu certo faltava essas duas linhas no meu projeto

#DebuggerForceFullDeployment: true
#DebuggerForceStandardAssets: true

Muito obrigado pela dica
 
Top