stroke

How to outline a TextView?

 ̄綄美尐妖づ 提交于 2019-11-28 11:34:24
What I want to do? (blue will be changed as white) What I did? I have found a class which extends TextView that able to outline textview very close to what I want. The problem is that I could not change stroke color to any color, it draws always as black. How to set border color as white? What is my output: Where are my codes? public class TypeFaceTextView extends TextView { private static Paint getWhiteBorderPaint(){ Paint p = new Paint(Color.WHITE); return p; } private static final Paint BLACK_BORDER_PAINT = getWhiteBorderPaint(); static { BLACK_BORDER_PAINT.setXfermode(new

Drawing line less than one pixel thick requires anti-aliasing in Android 4.2

僤鯓⒐⒋嵵緔 提交于 2019-11-28 10:04:32
问题 I'm trying to draw a very thin line (less than one pixel thick) in android. I'm using Paint blackThin = new Paint(); blackThin.setStrokeWidth(0.1f); blackThin.setColor(Color.BLACK); to initialize the paint object. This works fine in Android 2.2, but when I try it in 4.2 (also 4.1, I think - I tested that one briefly - I haven't tested any other versions other that 2.2, 4.1.2 and 4.2) the lines won't show up when I draw them. To make them show up in 4.2, it seems like I have to set the anti

Android Paint stroke width positioning

僤鯓⒐⒋嵵緔 提交于 2019-11-28 07:17:31
Given this code to draw a line: Paint p; p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(android.graphics.Color.WHITE); p.setStyle(Paint.Style.FILL); p.setStrokeWidth(21); canvas.drawLine(0,50,100,50,p); there are 3 possible stroke-drawing strategies: Inside: The line is painted in the rectangle (0,50,100,70) Center: The line is painted in the rectangle (0,40,100,60) Outside: The line is painted in the rectangle (0,30,100,50) In practice it appears that default behavior follows the Center strategy. Is it possible to modify a paint to produce results corresponding to one of the other

Smoothing a rounded stroke in Core Graphics

我是研究僧i 提交于 2019-11-28 04:52:53
问题 I am creating my own UITableViewCells with a gradient background. I have all the logic and drawing worked out, but one thing I want to fix is the "chunkiness" around the corners of my custom cell: alt text http://grab.by/27SM If you zoom in on the corners, you can see what I am talking about. Here is the code I a using to generate the cell: CGContextRef c = UIGraphicsGetCurrentContext(); CGColorSpaceRef myColorspace = CGColorSpaceCreateDeviceRGB(); CGGradientRef myGradient = nil; CGFloat

I need to change the stroke color to a user defined color. Nothing to do with the state

耗尽温柔 提交于 2019-11-28 03:33:00
I need to change the stroke color from the app. The user is able to change the background color so I need to also let them change the stroke (outline) of the button. As its is already set in the drawable (sample below) I have not found a way to change this. Seems like all of the other questions like this just said to use the XML file.... but that doesnt let me make it dynamic. Thank you for any help! I need to change the stroke color to a user defined color. Nothing to do with the state. <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android">

Border in shape xml

时间秒杀一切 提交于 2019-11-27 09:16:27
问题 I am trying to make a drawable to use for a button. I would like it to have this coloring, with a 2px border around it. Everything works just fine except I cannot get the border to show up... <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:startColor="@color/bar_clicked_dark" android:endColor="@color/bar_clicked_light" android:angle="90"/> <corners android:bottomLeftRadius="0dp" android

How to outline a TextView?

泪湿孤枕 提交于 2019-11-27 06:18:16
问题 What I want to do? (blue will be changed as white) What I did? I have found a class which extends TextView that able to outline textview very close to what I want. The problem is that I could not change stroke color to any color, it draws always as black. How to set border color as white? What is my output: Where are my codes? public class TypeFaceTextView extends TextView { private static Paint getWhiteBorderPaint(){ Paint p = new Paint(Color.WHITE); return p; } private static final Paint

how to change the color of route in google maps v3

荒凉一梦 提交于 2019-11-27 04:25:01
问题 I am using this code to get directions between two points. Is it possible to change the color of the route from blue? I am not using polyline in my code. Thanx in advance :) 回答1: You can specify the color of the line when you create the DirectionsRenderer, using the optional DirectionsRendererOptions struct. This works for me, simply changing the line where the DirectionsRenderer object is created: <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable

Android Paint stroke width positioning

时光怂恿深爱的人放手 提交于 2019-11-27 01:51:06
问题 Given this code to draw a line: Paint p; p = new Paint(Paint.ANTI_ALIAS_FLAG); p.setColor(android.graphics.Color.WHITE); p.setStyle(Paint.Style.FILL); p.setStrokeWidth(21); canvas.drawLine(0,50,100,50,p); there are 3 possible stroke-drawing strategies: Inside: The line is painted in the rectangle (0,50,100,70) Center: The line is painted in the rectangle (0,40,100,60) Outside: The line is painted in the rectangle (0,30,100,50) In practice it appears that default behavior follows the Center