0
我需要在Android電視應用默認情況下關注(未選中)第一項。 我嘗試下面的代碼在我的活動,其中列表視圖定義,但不工作如何將關注的第一項列表視圖(使用列表選擇器)
list_view.setAdapter(new LoadRecordListAdapter(getActivity(),
R.layout.child_load_recordlist, LoadScheduleRecordsList));
list_view.setSelection(0);
list_view.getChildAt(0).requestFocus();
我使用listselector所以我不能把下面的代碼在我的列表視圖適配器。
if(position==0){
listview.requestfocus();
}
那麼誰能幫我找出解決方案?
解決
謝謝木屋
添加在Java
list_view.requestFocus();
在XML中只需添加
android:focusable="true"
android:focusableInTouchMode="true"
你使用leanback? –
沒有@MatiasOlocco –