小编sil*_*gle的帖子

边缘处的高斯模糊截止

我正在为android上的绘图程序开发一个svg导出实用程序.我遇到了一个问题,即背后的模糊被截止超过了形状边界 - 看起来我需要调整viewBox的大小或增加边距或其他东西.有谁知道最好的方法?

测试文件网址在这里 - 因为mime类型在服务器上没有正确设置而下载,我现在无法重新启动它:(.文件中有嵌入的图像和字体,这就是为什么它很大.但是如果你把它保存到磁盘,你可以用chrome,ff等打开...

给出了该问题的放大示例.注意橙色发光的方形边缘.

svg svg-filters

28
推荐指数
1
解决办法
6429
查看次数

Android Robolectric和矢量drawables

我在我的应用程序中使用了一些矢量drawables但仅适用于v21及更高版本 - 它们位于资源文件夹drawable-anydpi-v21中,并且还具有其他api级别的回退位图版本(drawable-hdpi.mdpi,...).

当我使用此配置运行robolectric时

@Config(sdk = 16, application = MyApp.class, constants = BuildConfig.class, packageName = "com.company.app")
Run Code Online (Sandbox Code Playgroud)

使用这些drawables在视图膨胀时出现以下错误

Caused by: android.content.res.Resources$NotFoundException: File ./app/build/intermediates/data-binding-layout-out/dev/debug/drawable-anydpi-v21/ic_info_outline_white_24dp.xml from drawable resource ID #0x7f02010e
Caused by: org.xmlpull.v1.XmlPullParserException: XML file ./app/build/intermediates/data-binding-layout-out/dev/debug/drawable-anydpi-v21/ic_info_outline_white_24dp.xml line #-1 (sorry, not yet implemented): invalid drawable tag vector
Run Code Online (Sandbox Code Playgroud)

build.gradle的相关部分是:

   android {
      compileSdkVersion 23
      buildToolsVersion "23.0.3"
      defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 79
        versionName "0.39"
        // Enabling multidex support.
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true

        testApplicationId "com.example.app.test"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      testOptions {
        unitTests.returnDefaultValues = …
Run Code Online (Sandbox Code Playgroud)

android robolectric android-vectordrawable

8
推荐指数
1
解决办法
731
查看次数

android getSharedPreferences错误:没有name属性的map值:boolean

我试图弄清楚当我尝试获取应用程序的共享首选项时,它在启动时发生此错误的原因.代码只是:

settings = this.getSharedPreferences(Globals.PREFS_NAME,0)

看起来像一个腐败,但错误是在应用程序中,因为我已将其安装在多个设备上,并发生相同的错误.我卸载了应用程序并重新安装它无济于事.还做了一个完全干净的构建.我用Google搜索错误,似乎无法找到任何内容.

我以前工作得很好.所以我很难过.任何线索都会非常感激......

问候,

W/ApplicationContext( 1541): getSharedPreferences
W/ApplicationContext( 1541): org.xmlpull.v1.XmlPullParserException: Map value without name attribute: boolean
W/ApplicationContext( 1541):    at com.android.internal.util.XmlUtils.readThisMapXml(XmlUtils.java:521)
W/ApplicationContext( 1541):    at com.android.internal.util.XmlUtils.readThisValueXml(XmlUtils.java:733)
W/ApplicationContext( 1541):    at com.android.internal.util.XmlUtils.readValueXml(XmlUtils.java:667)
W/ApplicationContext( 1541):    at com.android.internal.util.XmlUtils.readMapXml(XmlUtils.java:470)
W/ApplicationContext( 1541):    at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:376)
W/ApplicationContext( 1541):    at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:146)
W/ApplicationContext( 1541):    at net.robmunro.mypod.WelcomeActivity.onEWCreate(WelcomeActivity.java:160)
W/ApplicationContext( 1541):    at net.robmunro.mypod.AbstractEWActivity.onCreate(AbstractEWActivity.java:25)
W/ApplicationContext( 1541):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
W/ApplicationContext( 1541):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
W/ApplicationContext( 1541):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
W/ApplicationContext( 1541):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
W/ApplicationContext( 1541):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
W/ApplicationContext( 1541):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/ApplicationContext( 1541): …
Run Code Online (Sandbox Code Playgroud)

android

7
推荐指数
1
解决办法
3550
查看次数

SVG 中的默认描边和填充

我对 SVG 中的描边和填充默认值感到困惑。

在SVG规范(http://www.w3.org/TR/SVG/painting.html#StrokeProperty)中,它说笔画属性的初始值是无 - 我猜这是透明的?默认描边宽度为 1。默认描边不透明度也应为 1

同样,对于 filll ( http://www.w3.org/TR/SVG/painting.html#FillProperty ),默认值应为黑色,不透明度为 1

Inkscape 和浏览器似乎假设笔画 = 黑色并且填充是透明的 - 是这样吗?有谁知道默认值应该是什么?我渲染的 SVG 似乎与浏览器和 inkscape 显示的内容不一致......

svg android fill stroke

5
推荐指数
1
解决办法
8422
查看次数

SVG标记渲染视图框

我试图在SVG中渲染一个标记 - 它应该是一个面向该行的空心箭头.标记是截止的(可能是因为路径以x轴为中心).如何扩展标记视图区域以便整个标记显示?

测试SVG文件是:http: //www.robmunro.net/misc/arrows.svg

正确的输出应该是:http: //www.robmunro.net/misc/arrows.png

svg markers

1
推荐指数
1
解决办法
2120
查看次数

onErrorResumeNext的rxjava行为

我无法让Observer.onErrorResumeNext按照我的预期行事.

Subscriber orchestratorObserver = new Subscriber<Integer>() {
    @Override
    public void onCompleted() {
        System.out.println("orchestratorObserver."+"onCompleted()");
    }

    @Override
    public void onError(Throwable e) {
        System.out.println("orchestratorObserver."+"onError()"+e.getMessage());
    }

    @Override
    public void onNext(Integer i) {
        System.out.println("orchestratorObserver."+"onNext() : "+i);
    }
};

@Test
public void rxTest() {
    Observable.range(0,5)
            .doOnNext(new Action1<Integer>() {
                @Override
                public void call(Integer integer) {
                    throw new RuntimeException("chain error!!");
                }
            })
            .onErrorResumeNext(Observable.just(-1))
            .subscribe(orchestratorObserver);
}

@Test
public void rxTest1() {

    final Observable<Integer> errorTrainObservable = Observable.defer(
            new Func0<Observable<Integer>>() {
                @Override
                public Observable<Integer> call() {
                    return Observable.error(new RuntimeException("source error"));
                } …
Run Code Online (Sandbox Code Playgroud)

android system.reactive rx-java

0
推荐指数
1
解决办法
884
查看次数