Remove SearchOrbView Android TV
Asked Answered
G

2

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

Gaby answered 13/7, 2015 at 13:36 Comment(2)
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?Hawger
@dextor yes I was, after removing the listener the orb is gone! Please make this an answer and I will acceptGaby
H
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.

Hawger answered 13/7, 2015 at 14:2 Comment(4)
How can I remove complete Title View from VerticalGridFragment. I removed search view icon but still some blank space left.Sham
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.Firedrake
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 github.com/dextorer/Sofa or github.com/dextorer/BuildingForAndroidTV.Hawger
@Firedrake 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.Diffluent
C
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" />
....
Czardom answered 31/12, 2016 at 9:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.