由于某些 GUI 要求,我正在使用EditText
&创建基于建议的搜索功能。PopupWindow
搜索和建议工作完美,但我无法通过 Dpad浏览搜索EditText
和列出项目。PopupWindow
以下是我整个屏幕的布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/center_baseline"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_centerInParent="true" />
<View
android:id="@+id/top_baseline"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="@+id/center_baseline"
android:layout_marginBottom="50dp" />
<View
android:id="@+id/bottom_baseline"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/center_baseline"
android:layout_marginTop="45dp" />
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignBottom="@id/bottom_baseline"
android:layout_alignParentTop="true"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true">
<ImageView
android:id="@+id/top_shelf_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="@dimen/top_shelf_image_alpha"
android:contentDescription="@string/app_name"
android:scaleType="fitXY" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/home_screen_top_bar_height"
android:layout_alignParentTop="true"
android:alpha="@dimen/home_screen_top_bar_alpha"
android:background="@color/black" />
<ImageView
android:id="@+id/app_logo"
android:layout_width="wrap_content"
android:layout_height="@dimen/home_screen_logo_height"
android:layout_marginLeft="20dp"
android:contentDescription="@string/app_name"
android:gravity="center"
android:padding="5dp"
android:src="@drawable/ic_app_logo" />
<EditText
android:id="@+id/team_search_bar"
android:layout_width="@dimen/home_screen_search_bar_width"
android:layout_height="@dimen/home_screen_logo_height"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:hint="@string/lb_search_bar_hint"
android:imeOptions="actionSearch"
android:inputType="text"
android:lines="1"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
android:padding="8dp" />
<TextView
android:id="@+id/team_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:layout_marginLeft="@dimen/home_screen_content_margin_left"
android:layout_marginTop="20dp"
android:text="@string/home_title"
android:textColor="@color/white"
android:textSize="@dimen/home_screen_title" />
<TextView
android:id="@+id/team_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/team_title"
android:layout_marginEnd="600dp"
android:layout_marginLeft="@dimen/home_screen_content_margin_left"
android:layout_marginStart="25dp"
android:layout_marginTop="10dp"
android:maxLines="4"
android:maxWidth="600dp"
android:scrollHorizontally="false"
android:text="@string/short_description"
android:textColor="@color/team_desciption_color"
android:textSize="@dimen/home_screen_short_description" />
</RelativeLayout>
<fragment
android:id="@+id/main_browse_fragment"
android:name=".ui.HomeFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/top_baseline"
android:nextFocusUp="@+id/team_search_bar"
tools:context=".ui.HomeActivity"
tools:deviceIds="tv"
tools:ignore="MergeRootFrame" />
</RelativeLayout>
BrowseFragment
卡中包含一些细节。一切正常,除了我无法浏览EditText
和.ListView
PopupWindow
有什么方法可以让我使用 D-pad 进行导航吗???