问题描述
谷歌不帮我找到我的问题的解决方案。 (据我一直在寻找...)。
Google doesn't help me find a solution of my problem. (As far I was looking for...).
我想知道是否有可能绘制点线与Android 9补丁的能力。
I want to know if it's possible to draw a dotted line with 9 patch capabilities on Android.
我的目标是从布局到另一个画一条虚线。
My goal is to draw a dotted line from a layout to another one.
我想大约9修补程序,因为我想要的虚线是在每一个活动一样。 (不要拉伸)。
I thought about 9 patch because I want the dotted line to be the same in every Activities. (not to be stretched).
这可能吗?或者,也许有更好的解决办法?
Is that possible ? Or maybe is there a better solution ?
下面我想什么一个例子(实线): http://hpics.li/866bb56一>
Here an example (with a solid line) of what I would like : http://hpics.li/866bb56
感谢
推荐答案
其实,我没有使用的形状,因为我需要一个垂直的虚线和另外一个水平。
Actually, i'm not using shape because I need one vertical dotted line and another one horizontal.
和它不可能获得与形状竖线。 (事实上,这是可能的,但不是本地,结果是不是我期待)。
And it's not possible to get vertical line with shape. (In fact, it's possible but not natively and the result is not what i'm expecting).
所以我带了虚线,maked 2小图像有了它,一个水平和另一个垂直。
然后,我创建了2 XML文件,每个方向并调用我的重复模式绘制
So i took my dotted line, maked 2 small images with it, one horizontal and the another one vertical.Then I created 2 xml file for each orientation and call my drawable with repeat mode
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/pointilles_horizontal_pattern"
android:tileMode="repeat" />
谢谢大家!
这篇关于画出9补丁点缀/虚线在Android上线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!