Android Canvas Not Drawing On Rtl
I have the following view class: public class MyHorizontalViewIndicator extends View{ protected synchronized void onDraw(Canvas canvas) { super.onDraw(canvas);
Solution 1:
In Manifest.xml have you added android:supportsRtl
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Change this line canvas.drawText("Test",90, 90, paint);
to
canvas.drawText("Test",bound.top-100, bound.left-100, paint);
try the negative value for the drawtext
and also change and try the layoutDirection=LOCALE in xml
Solution 2:
you can add this code :
layoutDirection = LayoutDirection.LTR
Post a Comment for "Android Canvas Not Drawing On Rtl"