S
S
stanleylexx2019-06-19 15:04:10
Android
stanleylexx, 2019-06-19 15:04:10

How to remove focus from button when opening activity?

Hello. I have a question. There is such a template for activity:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/gtvBgNormal"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/hf_header_fragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="vertical" />

    <LinearLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/hf_header_fragment"
        android:layout_above="@+id/hf_footer_fragment"
        android:orientation="vertical" />

    <LinearLayout
        android:id="@+id/hf_footer_fragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical" />

</RelativeLayout>

In different activities, different fragments are substituted for header_fragment , fragment_container and footer_fragment . header and footer do not change, but instead of a container, there can be a linear or grid layout. There is an ImageButton in the header. When you open an activity, this button almost always gets the focus. The application is mainly focused on TV boxes. To go to the items in the container, you have to click the remote once again. How to make it so that at the beginning the focus on the button in the header is not set, but is placed on the first item in the container fragment. Sorry for the somewhat confusing explanation. I've tried different methods, but I can't get the desired result. Either the button cannot be selected at all, or there is no focus at all, etc.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question