小编The*_*nda的帖子

Android布局预览编辑器-布局不可见:java.lang.IllegalArgumentException:对象不是声明类的实例

我的Android Studio布局编辑器无法正常工作。在对布局进行更改之后,预览始终会消失并变成完全白屏或冻结(我无法选择任何元素,并且对xml文件所做的更改不可见)。这在任何布局文件中都会发生。使chach无效并重新启动后,我可以再次工作但是在进行其他更改之后,我又遇到了同样的问题。执行干净的构建也无济于事。

布局编辑器显示以下异常:

java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at android.animation.PropertyValuesHolder_Delegate.callMethod(PropertyValuesHolder_Delegate.java:108)
at android.animation.PropertyValuesHolder_Delegate.nCallFloatMethod(PropertyValuesHolder_Delegate.java:143)
at android.animation.PropertyValuesHolder.nCallFloatMethod(PropertyValuesHolder.java)
at android.animation.PropertyValuesHolder.access$400(PropertyValuesHolder.java:38)
at android.animation.PropertyValuesHolder$FloatPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:1387)
at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:990)
at android.animation.ValueAnimator.animateBasedOnTime(ValueAnimator.java:1339)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1471)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:947)
at android.view.Choreographer.doCallbacks(Choreographer.java:761)
at android.view.Choreographer_Delegate.doFrame(Choreographer_Delegate.java:66)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:563)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:425)
at com.android.layoutlib.bridge.BridgeRenderSession.render(BridgeRenderSession.java:120)
at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:151)
at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:133)
at com.android.tools.idea.rendering.RenderTask.lambda$null$8(RenderTask.java:755)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)

但是我无法理解发生了什么。我什至不确定这个错误是否是我的问题的原因。也许你可以帮忙。

注意:我正在使用Theme.MaterialComponents.Light.NoActionBar …

android android-layout-editor

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

编译器如何推断这个 Box::leak(node).into() 中的类型?

我试图理解linked_list.rs,我在push_back_node函数 where nodeis a 中遇到了这一行Box

let node = Some(Box::leak(node).into());
Run Code Online (Sandbox Code Playgroud)

Option<NonNull<Node>>>即使没有指定类型,这也会以某种方式产生。这里发生了什么,为什么会起作用?

type-inference rust

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

Libgdx meshbuilder手动创建3d对象

我正在使用 Libgdx (Java) 并尝试构建 3D 模型。目前,我可以使用已定义的方法(例如modelBuilder.createBox()或 )创建模型modelBuilder.createSphere()。但是,我想使用自定义网格(根据一些基本数学计算顶点)构建自己的球体,然后细分以增加面数。例如,从二十面体开始,然后进一步细分以增加面数。我必须手动执行此操作,因为似乎没有任何更简单的方法可以执行此操作。我想这样做是因为以后想分别针对这些人脸来为所说的人脸应用独特的颜色/纹理。

在此处输入图片说明

我想如果有人帮我制作一个自定义/手动立方体,我可能会解决其余的问题。

我的环境已经设置好了,我目前可以使用预定义的方法构建一个球体:

public class ManagerSphere {

    //Settings
    public String ASSET_TEXTURE_BOX = "data/libgdx.png";
    public float SPHERE_RADIUS = 2f;

    //init
    private GameScreen _gameRef;
    private ModelBuilder modelBuilder = new ModelBuilder();
    private Texture tex;
    private Material mat;
    private ModelInstance boxInstance;
    public AssetManager assets;

    public ManagerSphere(GameScreen gameRef) {
        this._gameRef = gameRef;
        createSphere();
    }


    public void createSphere() {
        this.tex = new Texture("spheretexture02.jpg"); 
        this.mat = new Material(TextureAttribute.createDiffuse(this.tex));

        Model tempSphere;
        tempSphere = modelBuilder.createSphere(SPHERE_RADIUS*2, …
Run Code Online (Sandbox Code Playgroud)

java 3d mesh libgdx

5
推荐指数
0
解决办法
3258
查看次数

将文本颜色应用于 HTML 列

<table>
    <colgroup>
        <col style="color: green"/>
        <col style="background-color:green"/>
        <col class="char"/>
    </colgroup>
    <tr>
        <th>
            Decimal
        </th>
        <th>
            Hex
        </th>
        <th>
            Char
        </th>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

我一生都无法弄清楚为什么 Decimal 不是绿色的!

我需要整个列都是绿色字体,背景颜色出于某种原因起作用。

有没有办法在不向每个 tr 添加类的情况下做到这一点?

我需要能够为每一列应用不同的颜色。

html css html-table col

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

为什么列表不能包含在`Integer ...'参数中

这是我想要做的:

public void add(Integer... newIntegers) {
    for (Integer i : newIntegers) {
        integers.add(i);
    }
}
Run Code Online (Sandbox Code Playgroud)

我不知道为什么,但我不能ArrayList<Integer>在方法中加入.

我很高兴只是复制列表的方法,但我认为必须有一个更有效的方法.

我尝试了下面的想法,我可以为catch块做你能做的事情:

public void add(Integer... | List<Integer> newIntegers) {
    for (Integer i : newIntegers) {
        integers.add(i);
    }
}
Run Code Online (Sandbox Code Playgroud)

然而,在快速StackOverfow之后,发现它是不可能的.还有其他方法吗?

java arrays parameters methods list

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