Android Question Resize Searchview

ASanchez

New Member
Licensed User
Longtime User
Hello:

Been around this forum for a little while, first I want to thank to all members, for i've learned a lot from reading your posts.

Now, the question that finally pushed me to write: I have a project that make use of a ListView, as per Contacts Search example. I want to resize the embedded scrollview to match the screen with or without the virtual keyboard showing.

I have added the view with

sv.AddToParent(Activity, 0, 0, 95%x, 80%y) and tried to resize it with
sv.height at no avail.

Is there a way to do it?:confused:
 

thader2012

Member
Licensed User
Longtime User
Hi, I understand that you use un LISTVIEW.

Add ListView with name PEPE for example is
B4X:
Activity.AddView(PEPE,left,Top, Width, Height)
There, you say the heigth of the listview
You can change the height using
B4X:
PEPE.height= 100dip
where 100dip is the new dimension
 
Upvote 0

ASanchez

New Member
Licensed User
Longtime User
Hi Thader.
I'm really sorry, I asked for help on a ListView while I'm using a SearchView.. :S:oops:
As for your response, Thats exactly what I'm trying to do, except than SearchView doesnt accept .height
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
You can add a panel to the activity and then add the searchview to the panel and change the panel height that way.


B4X:
Dim sv As SearchView
Dim MyPanel As Panel
 
 
MyPanel.Initialize("")
Activity.AddView(MyPanel,0,0,95%x,80%y)
MyPanel.Color=Colors.Cyan
sv.Initialize(Me, "sv")
sv.AddToParent(MyPanel, 0, 0, 60%x, 60%y)
 
Upvote 0

ASanchez

New Member
Licensed User
Longtime User
Thank you very much for your answers.

I kind of mixed your solutions, embedding a searchview in a panel and in IME_HeightChanged this code:

B4X:
    pnl.Height= NewHeight*0.80
    sv.HeightChanged (pnl.Height )



In ListView module code I added:


B4X:
Public Sub HeightChanged(NewHeight As Int )
    lv.Height = NewHeight-et.Height
End Sub
 
Upvote 0
Top