Note that there are some explanatory texts on larger screens.

plurals
  1. POstyle from styles.xml not reload after changing locale
    primarykey
    data
    text
    <p>my application has two language.right to left and left to right. i change locale inside of application(not from phone setting). and reload data on resume() function to see changes on UI. i have two folders for values.one values-en, one values-fa. to change direction of textview to RTL and LTR,put two styles.xml in these folders. styles.xml (values-en) :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;style name="Direction"&gt; &lt;item name="android:gravity"&gt;left&lt;/item&gt; &lt;item name="android:layout_gravity"&gt;left&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>styles.xml (values-fa) :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;style name="Direction"&gt; &lt;item name="android:gravity"&gt;right&lt;/item&gt; &lt;item name="android:layout_gravity"&gt;right&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>and to use this style,for example i do it:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/menutext" android:layout_width="fill_parent" android:layout_height="wrap_content" style="@style/Direction" android:padding="0dp"/&gt; &lt;/RelativeLayout&gt; </code></pre> <p>if i run application,everything is ok,and direction of textview is related to locale.<strong>problem is here</strong> that when i change language from app's setting from option menu,data load correct,but direction not.and i'm should go to another activity to see changes of direction.</p> <p>to solve this problem,can i remove styles.xml because of i'm using Html.fromHtml() and my data have</p> <pre><code>&lt;p dir="LTR"&gt; </code></pre> <p>and</p> <pre><code>&lt;p dir="RTL"&gt; </code></pre> <p>tags?</p> <p>another probable solution(thanks to TOMCA for comment) : <a href="https://stackoverflow.com/questions/3241729/android-dynamically-change-style-at-runtime">android dynamically change style at runtime</a></p> <p>but problem still alive.anybody have a idea?</p>
    singulars
    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.
 

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