1. Develop Android TV APP, use the remote control to select the button or choose another menu
If not highlighted, you cannot see which button or menu is selected
2. drawable Add Border_red.xml Set highlight
<?xml version="1.0"encoding="Utf-8"? ><shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="2DP"/> <Stroke Android:color="#FF0000"Android:width="3DP"/> <solid android:color="#00FF0000"/></shape>
View Code
3. Add page XML to layout
<?xml version="1.0"encoding="Utf-8"? ><linearlayout xmlns:android="http://schemas.android.com/apk/res/android"Android:layout_width="match_parent"Android:layout_height="match_parent"android:orientation="Vertical"> <relativelayout android:focusable="false"android:gravity="Center"android:layout_gravity="Center"android:cliptopadding="false"Android:clipchildren="false"Android:id="@+id/main"Android:layout_width="match_parent"Android:layout_height="wrap_content"> <Button Android:id="@+id/button_id_1"Android:layout_width="match_parent"android:gravity="Center"Android:layout_height="wrap_content"Android:background="#303F9F"Android:focusableintouchmode="true"Android:textcolor="#FFF"Android:layout_margintop="10DP"Android:layout_marginleft="0DP"Android:text="Button"android:textsize="60DP"/> <Button Android:id="@+id/button_id_2"Android:layout_below="@id/button_id_1"Android:layout_width="match_parent"android:gravity="Center"Android:layout_height="wrap_content"Android:background="#303F9F"Android:focusableintouchmode="true"Android:textcolor="#FFF"Android:text="Button"Android:layout_margintop="30DP"android:textsize="60DP"/> <Button Android:id="@+id/button_id_3"Android:layout_width="match_parent"android:gravity="Center"Android:layout_height="wrap_content"Android:background="#303F9F"Android:layout_below="@id/button_id_2"Android:focusableintouchmode="true"Android:textcolor="#FFF"Android:text="Button"Android:layout_margintop="30DP"android:textsize="60DP"/> </RelativeLayout></LinearLayout>
View Code
4. Add check highlighting to set focus control
New Borderview (this); Border.setbackgroundresource (r.drawable.border_red); = (relativelayout) Findviewbyid (r.id.main); Border.attachto (main);
View Code
Android TV Check Highlighting