gpt4 book ai didi

Android 如何设置 RemoteView 的权重?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:45:19 25 4
gpt4 key购买 nike

我需要知道允许我设置 RemoteView 的权重的代码。

我试过这段代码,但这不起作用:

RemoteViews remoteViews = new RemoteViews(c.getPackageName(), R.layout.notification);
remoteViews.setInt(R.id.ll_notification, "setWeight", 12);

有办法吗?非常感谢....

最佳答案

我认为 RemoteView 没有权重属性。

我不确定这是否有效,但请尝试一下。

    RemoteViews remoteViews = new RemoteViews("", 0);

LinearLayout.LayoutParams tempLayoutParams =new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
tempLayoutParams.weight = 1.0f;

LinearLayout tempLinearLayout = new LinearLayout(getContext()):
tempLinearLayout.setLayoutParams(tempLayoutParams);

tempLinearLayout.addView(remoteViews);

祝你好运。

关于Android 如何设置 RemoteView 的权重?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11595883/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com