Note that there are some explanatory texts on larger screens.

plurals
  1. POLosing EditText style after adding Views programmatically in Android
    primarykey
    data
    text
    <p>I have a layout called wizard that has an empty ViewFlipper inside of it.</p> <p>I have other views that include this 'wizard' and programmatically add children to the ViewFlipper inside the wizard. The problem I'm having is that one of these children has an EditText, and this View loses it's default style. I tried setting everything up in the xml file and the problem dissapeared, so the problem is in adding the views programmatically. I Also tried calling invalidate() on the main container (in the code below: <code>@+id/recarga_celular_main</code>), but nothing happens. The Edit text can be seen in the following link: <a href="http://i42.tinypic.com/35cn15g.png" rel="nofollow">EditText weird style problem</a></p> <p>The view is something like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/recarga_celular_main" android:layout_width="match_parent" android:layout_height="fill_parent" android:background="@drawable/theme_home_background" android:gravity="center_horizontal|top" &gt; ... &lt;CustomWizard android:id="@+id/recargaCelular_wizard" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_gravity="top" android:background="@drawable/theme_layer_blue_bottom_black" android:gravity="center_horizontal|center_vertical" &gt; &lt;/CustomWizard&gt; ... &lt;/RelativeLayout&gt; </code></pre> <p>The 'wizard' is something like:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/touch_wizard_main_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/transparent" android:gravity="center|top" android:orientation="vertical" &gt; ... &lt;ViewFlipper android:id="@+id/wizard_flipper" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/aceptar_limpiar_btns" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" /&gt; ... &lt;/LinearLayout&gt; </code></pre> <p>In the java code, first I add the view to the flipper, and then I display the desired child:</p> <pre class="lang-java prettyprint-override"><code>flipper.addView(step.getView(), flipper.getChildCount() - 1); ... flipper.setDisplayedChild(index); </code></pre> <p><strong>EDIT</strong></p> <p>Manually set the default EditText style:</p> <pre><code>&lt;EditText style="@style/some_style" android:background="@android:drawable/edit_text" android:gravity="left" android:hint="Celular" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload