Android Question (TabStripViewPager) label cutting the words and round top of label

Douglas Farias

Expert
Licensed User
Longtime User
Hi All.
i m using the TabStripViewPager, this is a nice lib and works very fine on my devices.
today i found a strange and small bug.




Here is what i need make
certo.jpg



and here is what i made with TabStripViewPager
errado.jpg

errado2.jpg




Question 1
Why are words being cut off if there is still space for them?
how can i remove this? its possible?
If you can not remove it, can you reduce it?




Question 2
Is it possible to round only the top of a label?
note: In the first image, which is what I need to do, the image has the top part rounded, but the bottom part is not round.

its possible round only the top of a label?


thx all
 

Douglas Farias

Expert
Licensed User
Longtime User
Lets start with the text. Try to set the labels padding to 0:
B4X:
For Each lbl As Label In GetAllTabLabels(TabStrip1)
     lbl.Padding = Array As Int(0, 0, 0, 0)
   Next
Thank you, it worked perfectly, I will use this in future projects, thank you very much.


about the question 2
is it possible? round only a top of a view? label panel etc?
on this project i need round only a top of a label, like the first image

But I already had to round off the top of a panel in another project and I could not.

I tried to use the mask example, but it did not help much, because the background was not a fixed color but a color with transparency and an image behind.

Is there any way to use cornerradius only on top view?

many thx again
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code creates a drawable with top rounded corners:
B4X:
Dim cd As ColorDrawable
cd.Initialize(0xFFAB99AB, 0)
lbl.Background = cd
Dim jo As JavaObject = lbl.Background
jo.RunMethod("setCornerRadii", Array(Array As Float(15dip, 15dip,15dip, 15dip, 0, 0, 0, 0)))
However it doesn't work in this case. It seems like the TabStrip changes the drawable internally when the page changes.
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
This code creates a drawable with top rounded corners:
B4X:
Dim cd As ColorDrawable
cd.Initialize(0xFFAB99AB, 0)
lbl.Background = cd
Dim jo As JavaObject = lbl.Background
jo.RunMethod("setCornerRadii", Array(Array As Float(15dip, 15dip,15dip, 15dip, 0, 0, 0, 0)))
However it doesn't work in this case. It seems like the TabStrip changes the drawable internally when the page changes.
no problem, i will use a white panel in front, no problem.
thx, i will use this code in another projects.

thx again
 
Upvote 0
Top