有關TV的BrowseFragment。最近碰到個需求需要可以調整 側邊欄的寬度。大家又碰到這種需求的嗎?
我分析了下思路:
1、查看api看有沒有暴露的方法。最終沒找到。
2、側邊開啟關閉有相應的影片,通過影片修改view的寬度,但是不知道相關view/viewGroup如何獲得
大佬們都怎么做噠???
/**
* A fragment for creating Leanback browse screens. It is composed of a
* RowsFragment and a HeadersFragment.
* <p>
* A BrowseFragment renders the elements of its {@link ObjectAdapter} as a set
* of rows in a vertical list. The elements in this adapter must be subclasses
* of {@link Row}.
* <p>
* The HeadersFragment can be set to be either shown or hidden by default, or
* may be disabled entirely. See {@link #setHeadersState} for details.
* <p>
* By default the BrowseFragment includes support for returning to the headers
* when the user presses Back. For Activities that customize {@link
* Activity#onBackPressed()}, you must disable this default Back key support by
* calling {@link #setHeadersTransitionOnBackEnabled(boolean)} with false and
* use {@link BrowseFragment.BrowseTransitionListener} and
* {@link #startHeadersTransition(boolean)}.
* <p>
* The recommended theme to use with a BrowseFragment is
* {@link androidx.leanback.R.style#Theme_Leanback_Browse}.
* </p>
* @deprecated use {@link BrowseSupportFragment}
*/
uj5u.com熱心網友回復:
你自定義ViewGroup,在onMeasure設定寬度,在onDraw畫出你設定的寬度,當你修改寬度時執行 requestLayout和invalidate,轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/40854.html
標籤:Android
上一篇:android studio 中 com.thoughtworks.xstream與ksoap2沖突 java.util.zip.ZipException
