Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dotted line is actually not dotted when app is running on real Android device

in my app I use XML defined vertical dotted line.

<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android"     android:fromDegrees="90"     android:toDegrees="90"> <shape      android:shape="line">     <stroke          android:width="1dp"         android:color="@color/light_gray"         android:dashWidth="2dp"         android:dashGap="4dp"         /> </shape> 

When I am nitpicking my layout in Android Studio, the line is rendered properly dotted, as it should, but problem comes out when I run the app on real device. The line is just solid with no gaps..Do you know where could be the problem? I tried many different devices including those running latest 4.3 Android..It look everywhere the same:/

like image 581
simekadam Avatar asked Sep 21 '13 10:09

simekadam


People also ask

How do I make a dotted dashed line in Android?

This example demonstrates how do I make a dotted/dashed line in Android. Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 - Add the following code to res/layout/activity_main. xml.

What issue does dotted line represent?

Something Vague or Insubstantial. The dashed line gives us the visual vocabulary to express something vague or abstract. This idea is even translated into corporate-speak. When someone is a “dotted line report,” it indicates the person is not a direct report, though there is some connection and accountability.


1 Answers

This is most likely related to hardware acceleration: Dashed lines are not supported in GL mode.

Its documented here: https://code.google.com/p/android/issues/detail?id=29944

Turn off your HW-acceleration in your AndroidManifest.xml like this:

android:hardwareAccelerated="false" 

or:

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)  

For more information how to use first solution: http://developer.android.com/guide/topics/graphics/hardware-accel.html

like image 119
stoefln Avatar answered Oct 01 '22 19:10

stoefln