Android TV Check Highlighting

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.