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

            Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

            Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

            How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page