Android Question Scrollview in Tabstrip

FlyingEagle

Member
Licensed User
Longtime User
hi,

i'd like to show an activity within a scrollview which is placed within a tabstrip.

i know how to load the activity / layout in tabstrip with TabStrip1.LoadLayout but i do not know how to put the scrollview "between" them.

i have an activity with the scrollview itself and another with the tabstrip.

i do also want to use the scrollview several times, so i do not have to make a lot of scrollview activites.

do someone can point me out how to do this?

regards
 

DonManfred

Expert
Licensed User
Longtime User
i'd like to show an activity within a scrollview which is placed within a tabstrip
You can not put an activity inside a Scrollview. You can add the Scrollview to the Activity.
with TabStrip1.LoadLayout but i do not know how to put the scrollview "between" them.
There is no "between"... Load the Scrollview to the Tabstrip layout and use it here.

PS: You should use xCustomListview instead of Scrollview.
 
Upvote 0

FlyingEagle

Member
Licensed User
Longtime User
Do you have an example for?

may be, i sayed it wrong, i mean that my layout is in the scrollview and the scrollview in the tabstrip.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
You could add to your layout the scrollview and a panel that will include all views then just load the layout to your tabstrip and add the panel to the scrollview.
have a look at the example i did (just change 1 thing, instead of loading the layout to the activity load it to your tabstrip)

The forumsearch is working. You just need to use it.
Don´t expect me to do YOUR JOB to find the Tutorials.

you know don manfred that i am your friend but why do you answer like this.
it is very hard to search for something that you dont know what you really are looking for and also i would be offended if i would get such an answer and you can see that @FlyingEagle has very low msgs posted so he may not use the forum much and such answer may hold him back from asking again. sorry, but its rasping me to see such a response.
 

Attachments

  • Scrollview Example.zip
    1.9 KB · Views: 317
Upvote 0

FlyingEagle

Member
Licensed User
Longtime User
i am not very offended, i understand donmanfred, but i searched and do not found anything that fit my needs.

i will have a look to your example ilan.

what if i want to change the content=layout later in a scrollview i added maybe on first position after i added 10 more?
 
Last edited:
Upvote 0

FlyingEagle

Member
Licensed User
Longtime User
as i wrote in the german section, i wanted to use the xCustomListview, but then my layout want fit correctly. but nobody could help me there.

i have some troubles with layouting because of the abstract designer and the scripts. when i arranged my views and click on the script, everything is scaled (correctly) but my layout is gone more or less. it would be more comfortable when the designer interprets the script on the fly all the time.

the question about later change of a previous inserted layout in one the multiple inserted listviews is still unanswered too.

Hello,

I am having problems arranging views in a layout which will be inserted later in an xCustomview.

I look at it in the designer (F5) on the android device, it looks great, I insert it, I see only one label.

The layout should include 3 labels in a row, the left should adjust its size automatically, then the middle is aligned accordingly. The right should be located at the left of the left.
The anchor points are v.l.n. Left, Both, Right

B4X:
 lblLVInfo.Left = 5dip
lblLVInfo.Top = 0dip

lblLVInfo.Width = -2 '180dip

lblLVInfo.Height = -3 '30dip
lblLVValue.Height = lblLVInfo.Height
lblLVEinheit.Height = lblLVInfo.Height

lblLVValue.Top = lblLVInfo.Top
lblLVUnit.Top = lblLVInfo.Top

lblLVEinheit.Right = lblLVInfo.Left

lblLVWert.Left = lblLVInfo.Left + lblLVInfo.Width + lblLVInfo.Left
lblLVValue.Right = lblLVunit.Left - lblLVInfo.Left - lblLVunit.Width

'Panel
Underline.Left = lblLVInfo.Left
Underline.Right = lblLVInfo.Left
Underline.Top = lblLVInfo.Top + lblLVInfo.Height + 1 '31dip'

AutoScaleAll [/ CODE]

I have this in the main code:
    p.SetLayout (0, 0, 100% x, 36dip)

Although I would rather 100% y instead of 36dip there, but that is not synonymous.
Could someone please show me the way?

Layout Abstract Designer:

upload_2018-7-15_11-25-26.png


Layout after clicking in script section:

upload_2018-7-15_11-25-59.png
 
Last edited:
Upvote 0

FlyingEagle

Member
Licensed User
Longtime User
I made an example with all my problems in :)

- layout within xcustomlistview
- radiobox wiith images, how to get rid of the circle

i hope it will help to get answers
 

Attachments

  • xCustomListViewTest.zip
    27.5 KB · Views: 269
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I will list a few mistakes that I quickly see:

- Never load a layout before the panel size is set.
B4X:
p.LoadLayout("layoutLVItem") '<-- bug
p.SetLayout(0, 0, 100%x, 36dip)

- Prefer anchors over designer script when possible.
- In most cases a layout without anchors is a broken layout.

- This layout is incorrect. The error is explained in the visual designer video tutorial:

SS-2018-07-15_17.57.22.png


https://www.b4x.com/etp.html

- AutoScaleAll should be the first call in the designer script (if you are using it).

- Never use Msgbox. Use Log for debugging and use MsgboxAsync to show a dialog.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
For starters you do not need any designer scrips in your particular layouts.

Hint:

In the designer click on Tools > Send To UI Cloud, doing so will show you what your layouts look like on a number of actual devices, ignore deceives that you don't need.

Not needed, just place CLV1 left=0 and top=0, right edge=0 bottom edge=0, set horizontal and vertical anchors to both.

B4X:
CLV1.Left = 0
CLV1.Left = 0
CLV1.Top = 0
CLV1.Width = 100%x
CLV1.Height = 100%y

Again, remove this lot and use anchors instead.
B4X:
lblLVInfo.Left = 5dip
lblLVInfo.Top = 0dip

lblLVInfo.Width = -2 ' 180dip

lblLVInfo.Height = -3  ' 30dip
lblLVWert.Height = lblLVInfo.Height
lblLVEinheit.Height = lblLVInfo.Height

lblLVWert.Top = lblLVInfo.Top
lblLVEinheit.Top = lblLVInfo.Top

lblLVEinheit.Right = lblLVInfo.Left

lblLVWert.Left = lblLVInfo.Left + lblLVInfo.Width + lblLVInfo.Left
lblLVWert.Right = lblLVEinheit.Left - lblLVInfo.Left - lblLVEinheit.Width

' Panel
Underline.Left = lblLVInfo.Left
Underline.Right = lblLVInfo.Left
Underline.Top = lblLVInfo.Top + lblLVInfo.Height + 1 ' 31dip '

Like Erel said use this instead
B4X:
Dim p As Panel
    p.Initialize("")
    p.SetLayout(0, 0, 100%x, 36dip)
    p.LoadLayout("layoutLVItem")

The above is just for starters, Erel has given you more issues for you to fix. Strangely you have 1 layout that is already setup correctly/

Enjoy...
 
Upvote 0

FlyingEagle

Member
Licensed User
Longtime User
may it be possible, that this p.SetLayout(0, 0, 100%x, 36dip) uses the full size of the activity, instead the width of the listview?
it seems that this is my problem, i used anchors and i used the script as 2nd try.

upload_2018-7-16_1-4-6.png


upload_2018-7-16_1-4-41.png


upload_2018-7-16_1-5-36.png


no script, no autoscale, only anchors
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
ay it be possible, that this p.SetLayout(0, 0, 100%x, 36dip) uses the full size of the activity, instead the width of the listview?
%x and %y in your code are always related to the activity size. In the designer script they are based on the panel or activity that loads the layout.
 
Upvote 0

FlyingEagle

Member
Licensed User
Longtime User
%x and %y in your code are always related to the activity size. In the designer script they are based on the panel or activity that loads the layout.

and how do i get the inner-width of a listview?

i hope it is sv.width or asview.width ;-)
 
Last edited:
Upvote 0
Top