1
我在我的電視應用程序中使用自定義搜索屏幕,而我的問題是我無法在啓動片段時將焦點設置在SearchBar
視圖中。我嘗試以下方法:Android TV - SearchBar focus
mSearchBar.setFocusable(true);
mSearchBar.requestFocus();
也試圖在XML
<android.support.v17.leanback.widget.SearchBar
android:id="@+id/search_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipChildren="false"
android:focusable="true">
<requestFocus />
</android.support.v17.leanback.widget.SearchBar>
這
mSearchBar.setSearchQuery("");
沒有上面設置的焦點爲SearchBar
是否將setFocusableInTouchMode()設置爲true以及修復它? – Andy 2015-02-25 21:25:42