Custom view with TextView and EditText doesn't work with android:fastForward The Next CEO of Stack OverflowHow do I center text horizontally and vertically in a TextView?Stop EditText from gaining focus at Activity startupHow to align views at the bottom of the screen?How to hide the title bar for an Activity in XML with existing custom themeHow do I make links in a TextView clickable?How do I put a border around an Android textview?Android SDK installation doesn't find JDKSet TextView style (bold or italic)Place cursor at the end of text in EditTextHow to change fontFamily of TextView in Android

Why didn't Khan get resurrected in the Genesis Explosion?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

How do I go from 300 unfinished/half written blog posts, to published posts?

How to make a variable always equal to the result of some calculations?

Do I need to enable Dev Hub in my PROD Org?

How to add tiny 0.5A 120V load to very remote split phase 240v 3 wire well house

Are there any unintended negative consequences to allowing PCs to gain multiple levels at once in a short milestone-XP game?

Why does standard notation not preserve intervals (visually)

What happened in Rome, when the western empire "fell"?

Novel about a guy who is possessed by the divine essence and the world ends?

Is "for causing autism in X" grammatical?

Why do remote companies require working in the US?

How do scammers retract money, while you can’t?

How does the mv command work with external drives?

What exact does MIB represent in SNMP? How is it different from OID?

Why don't programming languages automatically manage the synchronous/asynchronous problem?

What benefits would be gained by using human laborers instead of drones in deep sea mining?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Why am I allowed to create multiple unique pointers from a single object?

What connection does MS Office have to Netscape Navigator?

Does it take more energy to get to Venus or to Mars?

How did the Bene Gesserit know how to make a Kwisatz Haderach?

Is there a way to save my career from absolute disaster?

Is it professional to write unrelated content in an almost-empty email?



Custom view with TextView and EditText doesn't work with android:fastForward



The Next CEO of Stack OverflowHow do I center text horizontally and vertically in a TextView?Stop EditText from gaining focus at Activity startupHow to align views at the bottom of the screen?How to hide the title bar for an Activity in XML with existing custom themeHow do I make links in a TextView clickable?How do I put a border around an Android textview?Android SDK installation doesn't find JDKSet TextView style (bold or italic)Place cursor at the end of text in EditTextHow to change fontFamily of TextView in Android










1















I created a custom view that has the following layout:



<androidx.constraintlayout.widget.ConstraintLayout
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:id="@+id/hintTextLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/hintTextInputText"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:text="hint"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<ImageView
android:id="@+id/hintTextInputInputIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/hint_text_input_input_icon_margin_end"
android:scaleType="centerInside"
tools:src="@drawable/ic_eyeopen"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"/>

<TextView
android:id="@+id/hintTextInputPlaceholder"
android:layout_width="0dp"
android:layout_height="0dp"
android:lines="1"
android:gravity="top"
android:layout_marginEnd="@dimen/hint_text_input_input_placeholder_margin_end"
tools:text="placeholder"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"/>


<com.google.android.material.textfield.TextInputEditText
android:id="@+id/hintTextInputEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"
app:layout_constraintTop_toBottomOf="@+id/hintTextInputText"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/hint_text_input_input_margin_top"
android:layout_marginEnd="@dimen/hint_text_input_input_margin_end"
android:lines="1"
android:background="@null"
android:textCursorDrawable="@null"
tools:text="edit"/
</androidx.constraintlayout.widget.ConstraintLayout>


Also I defined the view in attrs.xml file:



<declare-styleable name="HintTextInputView">
<attr name="hint_text_size" format="dimension"/>
<attr name="input_text_size" format="dimension"/>

<attr name="hint_text_color" format="color"/>
<attr name="input_text_color" format="color"/>
<attr name="input_hint_text_color" format="color"/>
<attr name="android:text"/>
<attr name="android:nextFocusForward"/>

<attr name="hint_text" format="string"/>
<attr name="input_hint_text" format="string"/>

<attr name="hint_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>
<attr name="input_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>

<attr name="enable_input_icon" format="boolean"/>
<attr name="input_icon_enabled_image" format="integer"/>
<attr name="input_icon_disabled_image" format="integer"/>
<attr name="input_icon_tint_color" format="color"/>

<attr name="enable_borders" format="boolean"/>
<attr name="border_color" format="color"/>
<attr name="focused_border_color" format="color"/>
<attr name="border_radius" format="dimension"/>
<attr name="android:inputType"/>
</declare-styleable>


I'm also setting the attributes programmatically to the EdditText when they're defined at any layout:



private fun TextView.setFocusForward(attributes: TypedArray) 
attributes.getResourceId(R.styleable.HintTextInputView_android_nextFocusForward, 0).let
if (it != 0)
this.nextFocusForwardId = it





This is what the XML that has the views looks like:



<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/name"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_start_end"
android:layout_marginTop="@dimen/register_company_edittext_top_margin_top"
android:layout_marginEnd="@dimen/register_company_margin_space_between"
android:text="@=viewModel.name"
android:nextFocusForward="@id/firstNickname"
app:hint_text="@string/register_edittext_name_hint"
app:input_hint_text="@string/register_edittext_name"
app:layout_constraintEnd_toStartOf="@+id/firstNickname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.4"
/>

<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/firstNickname"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_space_between"
android:layout_marginEnd="@dimen/register_company_margin_start_end"
android:imeOptions="actionNext"
android:nextFocusForward="@+id/secondNickname"
android:text="@=viewModel.nickname"
app:hint_text="@string/register_edittext_nickname_first"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/name"
app:layout_constraintTop_toTopOf="@+id/name"
app:layout_constraintVertical_bias="0.4"
/>


The problem is that the attribute android:nextFocusForward doesn't work at all. Even though I defined like above code, when I touch on next on my device's keyboard it doesn't lead to the right custom view but to the below custom view.



enter image description here










share|improve this question






















  • are you running on emulator

    – Manoj Perumarath
    Mar 8 at 14:40











  • @ManojPerumarath yes

    – Ana Paula
    Mar 8 at 15:03
















1















I created a custom view that has the following layout:



<androidx.constraintlayout.widget.ConstraintLayout
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:id="@+id/hintTextLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/hintTextInputText"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:text="hint"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<ImageView
android:id="@+id/hintTextInputInputIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/hint_text_input_input_icon_margin_end"
android:scaleType="centerInside"
tools:src="@drawable/ic_eyeopen"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"/>

<TextView
android:id="@+id/hintTextInputPlaceholder"
android:layout_width="0dp"
android:layout_height="0dp"
android:lines="1"
android:gravity="top"
android:layout_marginEnd="@dimen/hint_text_input_input_placeholder_margin_end"
tools:text="placeholder"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"/>


<com.google.android.material.textfield.TextInputEditText
android:id="@+id/hintTextInputEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"
app:layout_constraintTop_toBottomOf="@+id/hintTextInputText"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/hint_text_input_input_margin_top"
android:layout_marginEnd="@dimen/hint_text_input_input_margin_end"
android:lines="1"
android:background="@null"
android:textCursorDrawable="@null"
tools:text="edit"/
</androidx.constraintlayout.widget.ConstraintLayout>


Also I defined the view in attrs.xml file:



<declare-styleable name="HintTextInputView">
<attr name="hint_text_size" format="dimension"/>
<attr name="input_text_size" format="dimension"/>

<attr name="hint_text_color" format="color"/>
<attr name="input_text_color" format="color"/>
<attr name="input_hint_text_color" format="color"/>
<attr name="android:text"/>
<attr name="android:nextFocusForward"/>

<attr name="hint_text" format="string"/>
<attr name="input_hint_text" format="string"/>

<attr name="hint_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>
<attr name="input_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>

<attr name="enable_input_icon" format="boolean"/>
<attr name="input_icon_enabled_image" format="integer"/>
<attr name="input_icon_disabled_image" format="integer"/>
<attr name="input_icon_tint_color" format="color"/>

<attr name="enable_borders" format="boolean"/>
<attr name="border_color" format="color"/>
<attr name="focused_border_color" format="color"/>
<attr name="border_radius" format="dimension"/>
<attr name="android:inputType"/>
</declare-styleable>


I'm also setting the attributes programmatically to the EdditText when they're defined at any layout:



private fun TextView.setFocusForward(attributes: TypedArray) 
attributes.getResourceId(R.styleable.HintTextInputView_android_nextFocusForward, 0).let
if (it != 0)
this.nextFocusForwardId = it





This is what the XML that has the views looks like:



<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/name"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_start_end"
android:layout_marginTop="@dimen/register_company_edittext_top_margin_top"
android:layout_marginEnd="@dimen/register_company_margin_space_between"
android:text="@=viewModel.name"
android:nextFocusForward="@id/firstNickname"
app:hint_text="@string/register_edittext_name_hint"
app:input_hint_text="@string/register_edittext_name"
app:layout_constraintEnd_toStartOf="@+id/firstNickname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.4"
/>

<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/firstNickname"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_space_between"
android:layout_marginEnd="@dimen/register_company_margin_start_end"
android:imeOptions="actionNext"
android:nextFocusForward="@+id/secondNickname"
android:text="@=viewModel.nickname"
app:hint_text="@string/register_edittext_nickname_first"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/name"
app:layout_constraintTop_toTopOf="@+id/name"
app:layout_constraintVertical_bias="0.4"
/>


The problem is that the attribute android:nextFocusForward doesn't work at all. Even though I defined like above code, when I touch on next on my device's keyboard it doesn't lead to the right custom view but to the below custom view.



enter image description here










share|improve this question






















  • are you running on emulator

    – Manoj Perumarath
    Mar 8 at 14:40











  • @ManojPerumarath yes

    – Ana Paula
    Mar 8 at 15:03














1












1








1


1






I created a custom view that has the following layout:



<androidx.constraintlayout.widget.ConstraintLayout
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:id="@+id/hintTextLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/hintTextInputText"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:text="hint"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<ImageView
android:id="@+id/hintTextInputInputIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/hint_text_input_input_icon_margin_end"
android:scaleType="centerInside"
tools:src="@drawable/ic_eyeopen"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"/>

<TextView
android:id="@+id/hintTextInputPlaceholder"
android:layout_width="0dp"
android:layout_height="0dp"
android:lines="1"
android:gravity="top"
android:layout_marginEnd="@dimen/hint_text_input_input_placeholder_margin_end"
tools:text="placeholder"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"/>


<com.google.android.material.textfield.TextInputEditText
android:id="@+id/hintTextInputEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"
app:layout_constraintTop_toBottomOf="@+id/hintTextInputText"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/hint_text_input_input_margin_top"
android:layout_marginEnd="@dimen/hint_text_input_input_margin_end"
android:lines="1"
android:background="@null"
android:textCursorDrawable="@null"
tools:text="edit"/
</androidx.constraintlayout.widget.ConstraintLayout>


Also I defined the view in attrs.xml file:



<declare-styleable name="HintTextInputView">
<attr name="hint_text_size" format="dimension"/>
<attr name="input_text_size" format="dimension"/>

<attr name="hint_text_color" format="color"/>
<attr name="input_text_color" format="color"/>
<attr name="input_hint_text_color" format="color"/>
<attr name="android:text"/>
<attr name="android:nextFocusForward"/>

<attr name="hint_text" format="string"/>
<attr name="input_hint_text" format="string"/>

<attr name="hint_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>
<attr name="input_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>

<attr name="enable_input_icon" format="boolean"/>
<attr name="input_icon_enabled_image" format="integer"/>
<attr name="input_icon_disabled_image" format="integer"/>
<attr name="input_icon_tint_color" format="color"/>

<attr name="enable_borders" format="boolean"/>
<attr name="border_color" format="color"/>
<attr name="focused_border_color" format="color"/>
<attr name="border_radius" format="dimension"/>
<attr name="android:inputType"/>
</declare-styleable>


I'm also setting the attributes programmatically to the EdditText when they're defined at any layout:



private fun TextView.setFocusForward(attributes: TypedArray) 
attributes.getResourceId(R.styleable.HintTextInputView_android_nextFocusForward, 0).let
if (it != 0)
this.nextFocusForwardId = it





This is what the XML that has the views looks like:



<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/name"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_start_end"
android:layout_marginTop="@dimen/register_company_edittext_top_margin_top"
android:layout_marginEnd="@dimen/register_company_margin_space_between"
android:text="@=viewModel.name"
android:nextFocusForward="@id/firstNickname"
app:hint_text="@string/register_edittext_name_hint"
app:input_hint_text="@string/register_edittext_name"
app:layout_constraintEnd_toStartOf="@+id/firstNickname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.4"
/>

<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/firstNickname"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_space_between"
android:layout_marginEnd="@dimen/register_company_margin_start_end"
android:imeOptions="actionNext"
android:nextFocusForward="@+id/secondNickname"
android:text="@=viewModel.nickname"
app:hint_text="@string/register_edittext_nickname_first"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/name"
app:layout_constraintTop_toTopOf="@+id/name"
app:layout_constraintVertical_bias="0.4"
/>


The problem is that the attribute android:nextFocusForward doesn't work at all. Even though I defined like above code, when I touch on next on my device's keyboard it doesn't lead to the right custom view but to the below custom view.



enter image description here










share|improve this question














I created a custom view that has the following layout:



<androidx.constraintlayout.widget.ConstraintLayout
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:id="@+id/hintTextLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/hintTextInputText"
android:layout_width="0dp"
android:layout_height="wrap_content"
tools:text="hint"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

<ImageView
android:id="@+id/hintTextInputInputIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/hint_text_input_input_icon_margin_end"
android:scaleType="centerInside"
tools:src="@drawable/ic_eyeopen"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"/>

<TextView
android:id="@+id/hintTextInputPlaceholder"
android:layout_width="0dp"
android:layout_height="0dp"
android:lines="1"
android:gravity="top"
android:layout_marginEnd="@dimen/hint_text_input_input_placeholder_margin_end"
tools:text="placeholder"
app:layout_constraintTop_toTopOf="@+id/hintTextInputEditText"
app:layout_constraintBottom_toBottomOf="@+id/hintTextInputEditText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"/>


<com.google.android.material.textfield.TextInputEditText
android:id="@+id/hintTextInputEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/hintTextInputInputIcon"
app:layout_constraintTop_toBottomOf="@+id/hintTextInputText"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/hint_text_input_input_margin_top"
android:layout_marginEnd="@dimen/hint_text_input_input_margin_end"
android:lines="1"
android:background="@null"
android:textCursorDrawable="@null"
tools:text="edit"/
</androidx.constraintlayout.widget.ConstraintLayout>


Also I defined the view in attrs.xml file:



<declare-styleable name="HintTextInputView">
<attr name="hint_text_size" format="dimension"/>
<attr name="input_text_size" format="dimension"/>

<attr name="hint_text_color" format="color"/>
<attr name="input_text_color" format="color"/>
<attr name="input_hint_text_color" format="color"/>
<attr name="android:text"/>
<attr name="android:nextFocusForward"/>

<attr name="hint_text" format="string"/>
<attr name="input_hint_text" format="string"/>

<attr name="hint_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>
<attr name="input_text_style" format="enum">
<enum name="normal" value="0"/>
<enum name="bold" value="1"/>
<enum name="italic" value="2"/>
</attr>

<attr name="enable_input_icon" format="boolean"/>
<attr name="input_icon_enabled_image" format="integer"/>
<attr name="input_icon_disabled_image" format="integer"/>
<attr name="input_icon_tint_color" format="color"/>

<attr name="enable_borders" format="boolean"/>
<attr name="border_color" format="color"/>
<attr name="focused_border_color" format="color"/>
<attr name="border_radius" format="dimension"/>
<attr name="android:inputType"/>
</declare-styleable>


I'm also setting the attributes programmatically to the EdditText when they're defined at any layout:



private fun TextView.setFocusForward(attributes: TypedArray) 
attributes.getResourceId(R.styleable.HintTextInputView_android_nextFocusForward, 0).let
if (it != 0)
this.nextFocusForwardId = it





This is what the XML that has the views looks like:



<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/name"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_start_end"
android:layout_marginTop="@dimen/register_company_edittext_top_margin_top"
android:layout_marginEnd="@dimen/register_company_margin_space_between"
android:text="@=viewModel.name"
android:nextFocusForward="@id/firstNickname"
app:hint_text="@string/register_edittext_name_hint"
app:input_hint_text="@string/register_edittext_name"
app:layout_constraintEnd_toStartOf="@+id/firstNickname"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.4"
/>

<br.sis.smb.base.ui.HintTextInputView
android:id="@+id/firstNickname"
style="@style/DefaultEditTextBorder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/register_company_margin_space_between"
android:layout_marginEnd="@dimen/register_company_margin_start_end"
android:imeOptions="actionNext"
android:nextFocusForward="@+id/secondNickname"
android:text="@=viewModel.nickname"
app:hint_text="@string/register_edittext_nickname_first"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/name"
app:layout_constraintTop_toTopOf="@+id/name"
app:layout_constraintVertical_bias="0.4"
/>


The problem is that the attribute android:nextFocusForward doesn't work at all. Even though I defined like above code, when I touch on next on my device's keyboard it doesn't lead to the right custom view but to the below custom view.



enter image description here







android android-layout kotlin android-custom-view custom-view






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 14:15









Ana PaulaAna Paula

1,3681711




1,3681711












  • are you running on emulator

    – Manoj Perumarath
    Mar 8 at 14:40











  • @ManojPerumarath yes

    – Ana Paula
    Mar 8 at 15:03


















  • are you running on emulator

    – Manoj Perumarath
    Mar 8 at 14:40











  • @ManojPerumarath yes

    – Ana Paula
    Mar 8 at 15:03

















are you running on emulator

– Manoj Perumarath
Mar 8 at 14:40





are you running on emulator

– Manoj Perumarath
Mar 8 at 14:40













@ManojPerumarath yes

– Ana Paula
Mar 8 at 15:03






@ManojPerumarath yes

– Ana Paula
Mar 8 at 15:03













1 Answer
1






active

oldest

votes


















1














Make sure that you're not running on an emulator and on some emulator's nextfocusforward won't work, in that case you've to use nextFocusDown.




Also singleLine= true should be there and imeOptions =actionNext







share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55065032%2fcustom-view-with-textview-and-edittext-doesnt-work-with-androidfastforward%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Make sure that you're not running on an emulator and on some emulator's nextfocusforward won't work, in that case you've to use nextFocusDown.




    Also singleLine= true should be there and imeOptions =actionNext







    share|improve this answer



























      1














      Make sure that you're not running on an emulator and on some emulator's nextfocusforward won't work, in that case you've to use nextFocusDown.




      Also singleLine= true should be there and imeOptions =actionNext







      share|improve this answer

























        1












        1








        1







        Make sure that you're not running on an emulator and on some emulator's nextfocusforward won't work, in that case you've to use nextFocusDown.




        Also singleLine= true should be there and imeOptions =actionNext







        share|improve this answer













        Make sure that you're not running on an emulator and on some emulator's nextfocusforward won't work, in that case you've to use nextFocusDown.




        Also singleLine= true should be there and imeOptions =actionNext








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 8 at 15:31









        Manoj PerumarathManoj Perumarath

        1,69011229




        1,69011229





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55065032%2fcustom-view-with-textview-and-edittext-doesnt-work-with-androidfastforward%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229