diff --git a/UI/GameBrowser.cpp b/UI/GameBrowser.cpp index 8e6030affa..e3d9b7c8f1 100644 --- a/UI/GameBrowser.cpp +++ b/UI/GameBrowser.cpp @@ -778,7 +778,7 @@ void SearchBar::Draw(UIContext &dc) { int leftMargin = 10; if (image) { dc.Draw()->DrawImage(searchIcon, bounds_.x + leftMargin, bounds_.centerY(), 1.0f, 0xFFFFFFFF, ALIGN_VCENTER); - leftMargin += image->w + 10; + leftMargin += image->w; } dc.DrawText(searchFilter_, overlayBounds.x + leftMargin, overlayBounds.centerY(), 0xFFFFFFFF, ALIGN_VCENTER); } diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 71ecdddce8..e6d4c541e5 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -166,17 +166,22 @@ GameBrowser *MainScreen::CreateBrowserTab(const Path &path, std::string_view tit const bool portrait = GetDeviceOrientation() == DeviceOrientation::Portrait; - ScrollView *scrollView = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + LinearLayout *tabContainer = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + SearchBar *search = tabContainer->Add(new SearchBar(new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); + + ScrollView *scrollView = tabContainer->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT))); scrollView->SetTag(title); // Re-use title as tag, should be fine. GameBrowser *gameBrowser = new GameBrowser(GetRequesterToken(), path, browseFlags, portrait, bGridView, screenManager(), mm->T(howToTitle), howToUri, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)); + gameBrowser->SetSearchBar(search); + scrollView->Add(gameBrowser); gameBrowsers_.push_back(gameBrowser); - tabHolder_->AddTab(mm->T(title), ImageID::invalid(), scrollView); + tabHolder_->AddTab(mm->T(title), ImageID::invalid(), tabContainer); if (scrollPos) { scrollView->RememberPosition(scrollPos); }