3
晚上好(來自瑞典)!我正在建立一個基於一些複合視圖(包含一個或多個視圖的擴展布局)的GUI,我似乎無法按順序獲得焦點流。我主要想讓鍵盤上的'下一步'按鈕正常工作。目前按下它除了播放咔嗒聲之外什麼都不做。我曾嘗試:無法控制複合視圖內的焦點流程
android:nextFocusRight="@+id/ipDecimal"
android:nextFocusDown="@+id/ipDecimal"
和設置(在這裏和那裏)
android:focusable="true"
我到底做錯了什麼?我目前的目標是讓焦點從第一個流到第二個IntegerPicker。
這裏有2個組件我試圖在目前與之合作的佈局(他們都包括一個擴展的FrameLayout的):
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:focusable="true" >
<com.SverkerSbrg.Spendo.Graphics.InsertTransaction.IntegerPicker
android:id="@+id/ipInteger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
custom:NumberSize="40"
custom:TextAlignRight="true"
android:focusable="true"
custom:maxNrOfDigits="3"
android:nextFocusRight="@+id/ipDecimal"
android:nextFocusDown="@+id/ipDecimal">
<requestFocus />
</com.SverkerSbrg.Spendo.Graphics.InsertTransaction.IntegerPicker>
<TextView
android:id="@+id/tvDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:text="."
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="30sp"
tools:ignore="HardcodedText" />
<com.SverkerSbrg.Spendo.Graphics.InsertTransaction.IntegerPicker
android:id="@+id/ipDecimal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:focusable="true"
custom:NumberSize="20"
custom:TextAlignRight="false"
custom:maxNrOfDigits="2" >
</com.SverkerSbrg.Spendo.Graphics.InsertTransaction.IntegerPicker>
<TextView
android:id="@+id/tvSpace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"/>
<com.SverkerSbrg.Spendo.Graphics.InsertTransaction.CurrencyPicker
android:id="@+id/icCurrency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:textSize="20"
android:layout_gravity="bottom|center_horizontal">
</com.SverkerSbrg.Spendo.Graphics.InsertTransaction.CurrencyPicker>
</merge>
。
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
>
<EditText
android:id="@+id/etInteger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:inputType="number"
android:background="#00000000"
android:selectAllOnFocus="true"
android:focusable="true"
android:hint="00">
</EditText>
</merge>