9

How can I remove the searchOrbView in the BrowseFragment of Android TV?

I see a way to set the colors (setSearchAffordanceColors), but no way to actually remove the SearchOrbView

Since the TitleView is a private member of BrowseFragment (and TitleView is the way to get to the SearchOrbView), I see no way of actually removing the SearchOrbView

MobileMon
  • 8,341
  • 5
  • 56
  • 75
  • The search orb (according to the source code) should only be visible if you set a click listener to it. Is this something that you are currently doing? – Sebastiano Jul 13 '15 at 13:56
  • 1
    @dextor yes I was, after removing the listener the orb is gone! Please make this an answer and I will accept – MobileMon Jul 13 '15 at 14:01

2 Answers2

18

According to the official documentation, calling setOnSearchClickedListener() causes the search orb to be displayed in the title view.

Removing the method invocation will make the orb disappear.

Sebastiano
  • 12,289
  • 6
  • 47
  • 80
  • How can I remove complete Title View from VerticalGridFragment. I removed search view icon but still some blank space left. – Krishnakant Jan 27 '16 at 06:48
  • Same thing here, I am not able to remove the title view so there is a blank space that occupying real state in the UI. – Thiago Jan 27 '16 at 16:39
  • This is out of scope with respect to the OP. Also, my answer explicitly refers to the search orb, and to the search orb alone. You can set an empty (i.e., "") title, but the space will be filled nonetheless. AFAIK, `BrowseFragment` does not provide any way to disable the title view. You can go custom, using something like https://github.com/dextorer/Sofa or https://github.com/dextorer/BuildingForAndroidTV. – Sebastiano Jan 27 '16 at 16:45
  • @Thiago not sure if it's still relevant or necessary for you, but you can simply achieve that defining a new style with `Theme.Leanback.VerticalGrid` as parent and setting item `browseRowsMarginTop` to any dp value you need. Then set this theme for the Activity implementing the vertical grid view. – fasteque Jul 06 '16 at 07:15
  • @fasteque Thank you – Thiago Jul 08 '16 at 15:28
1

For those who doesnt read comments

you can simply achieve that defining a new style with Theme.Leanback.VerticalGrid as parent and setting item browseRowsMarginTop to any dp value you need. Then set this theme for the Activity implementing the vertical grid view. – fasteque

It helped me. style.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@style/Theme.Leanback"></style>
<style name="NoTitleTheme" parent="@style/Theme.Leanback">
    <item name="browseRowsMarginTop">5dp</item>
</style>
</resources>

AndroidManifest.xml ....

<activity
    android:name=".stackedadprogram.StackedAdProgramActivity"
    android:exported="true"
    android:parentActivityName=".launcher.ProgramDetailActivity"
    android:theme="@style/NoTitleTheme" />
....
Sely Lychee
  • 312
  • 1
  • 9