Skip to content Skip to sidebar Skip to footer

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

<applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:supportsRtl="true"android:theme="@style/AppTheme"><activityandroid:name=".MainActivity"><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid: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"