Android Question How to create a Layout like this

DonManfred

Expert
Licensed User
Longtime User
[OT]
to nearly every question in minutes.
But it needs this minutes (note that it implies a multiple of a Minute) to write one. Giving the Url for the relevant Tutorial is usually done in less than a minute.
For some Tutorials i do have shortcuts to copy the url easily; A answer can be done in less then 10 Seconds.

The threadopener does not really learn how it works when he just need to copy some code. The learneffect is zero.

It is not my intention to do the work for anyone if one can do it by himself if he knows how it works.
[/OT]
 
Upvote 0

ProjectGroup19

Active Member
Licensed User
With the Label2, if the string is lengthy, some part won't be shown. How do you deal with that?
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
With the Label2, if the string is lengthy, some part won't be shown. How do you deal with that?
Add StringUtils library to your project.
Then use
Label Sizing:
dim su as StringUtils
MyLabel.height = su.MeasureMultilineTextHeight(MyLabel,MyLabel.Text)
Hope I understood your needs.
Of course use your Label name.
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
It looks like there is a Maximum Default Height (like the second post) that can hide longer messages in the Label anyway.
This is something that you must decide how to manage, and it's all a matter of playing with the resize of the Panel (that contain all the post) and the Label (that contain the main message).
You have to decide a Standard Layout, apart from the lenght of the message that it will contain.
Then, when clicking it, you should make a resize of the Panel and of the Label (maybe using the code that I suggested above) to show the entire message.
Start playing with this informations for now if you can.
Did you managed to display something up to now?
If possible show us the relevant code (where you create the panel and add it to the CLV) so we can help you with your code.
 
Upvote 0

ProjectGroup19

Active Member
Licensed User
B4X:
Sub CreateListItem( Width As Int, Height As Int) As Panel
    'Dim p As B4XView=xui.CreatePanel("")
    'p.SetLayoutAnimated(0,0,0,100%x, 180dip)
    Dim p As Panel
    p.Initialize("")
    p.SetLayout(0, 0, Width, Height)
    p.LoadLayout("ALAYOUT")
   
lblTitle.Text = Connection.cu.GetString("TITLE")
    lblDescription.Text = Connection.cu.GetString("DESCRIPTION")
    lblDescription.Height=su.MeasureMultilineTextHeight(lblDescription,lblDescription.Text )
    
Dim date As Long = Connection.cu.GetString("DATE")
    Dim time As String = Connection.cu.GetString("TIME")
   
    lblDate.Text=DateUtils.GetDayOfWeekName(date)&", "&DateUtils.GetMonthName(date)&" "&DateTime.GetDayOfMonth(date)&", "&DateTime.GetYear(date)&" "&time'.GetHour(time)&":"&DateTime.GetMinute(time)&":"&DateTime.Getsecond(time)
   
    Return p
End Sub
 
Upvote 0

ProjectGroup19

Active Member
Licensed User

clv.Add(CreateListItem( clv.AsView.Width, 180dip), i)
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
OK.
In the afternoon I will try to give you some advices.
It would be good to edit the Discussion Title to something like "How to create a Layout like this?", because the actual title is meaningless.
And you got your answer here.
Now for the new question it would be good to create a New Discussion with a title like "How to resize and adapt a CLV Item?".
This is the good and requested way to use the forum to avoid informations dispersion.
One Question for Discussion.
In the case you can start the first post of the new discussion linking this discussion telling that is a related thing.
It's a bit tricky but you will get used to.
And be sure that you will receive all the answers.
In the meantime try to search in the forum for the same topic.
You could already find partial or total answer.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…