Android Question setlayout not exist for SearchView?

fifiddu70

Well-Known Member
Licensed User
Longtime User
i need to set the SearchView setlayout for open app in multi size screen, for example the edittext.setlayput is present but SearchView not present.
 

LucaMs

Expert
Licensed User
Longtime User
You should change the mBase variable from Private to Public, in the class and then use:
B4X:
SearchView1.mBase.SetLayout
but that doesn't mean the SearchView will scale optimally; you'll probably need to take some code from the class and use it in your project.


1724572897688.png
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
You should change the mBase variable from Private to Public, in the class and then use:
B4X:
SearchView1.mBase.SetLayout
but that doesn't mean the SearchView will scale optimally; you'll probably need to take some code from the class and use it in your project.


View attachment 156338
Sorry but non exist SearchView.mBase.SeLayout
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
LucaMs thanks, Now I hope to succeed in the operation, a question....when I type a word and it appears in the list of words found and then I click on the desired one, in the field where I typed the search word I am left with what I wrote, instead I would like it to clear the search box when I click on the found word so that I can immediately type another new word.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
LucaMs thanks, Now I hope to succeed in the operation, a question....when I type a word and it appears in the list of words found and then I click on the desired one, in the field where I typed the search word I am left with what I wrote, instead I would like it to clear the search box when I click on the found word so that I can immediately type another new word.
Add this sub to the SearchView class:
B4X:
Public Sub ClearEditText
    et.Text = ""
End Sub

In your project:
Sub SearchView1_ItemClick(Value As String)
    ' use the Value here, then:
    SearchView1.ClearEditText
End Sub
 
Upvote 0
Top