小编Pra*_*ast的帖子

Compose 中带有圆角的 CircularProgressIndicator

我正在尝试使用 jetpack compose 来圆化 CircularProgressIndicator 的角落。但我没有看到任何成员变量可以这样做。以下是源代码,但它没有将 Stroke 作为参数。如果可以的话,我们就可以创建带有圆帽的自定义笔画。

@Composable
fun CircularProgressIndicator(
    /*@FloatRange(from = 0.0, to = 1.0)*/
    progress: Float,
    modifier: Modifier = Modifier,
    color: Color = MaterialTheme.colors.primary,
    strokeWidth: Dp = ProgressIndicatorDefaults.StrokeWidth
) {
    val stroke = with(LocalDensity.current) {
        Stroke(width = strokeWidth.toPx(), cap = StrokeCap.Butt)
    }
    Canvas(
        modifier
            .progressSemantics(progress)
            .size(CircularIndicatorDiameter)
            .focusable()
    ) {
        // Start at 12 O'clock
        val startAngle = 270f
        val sweep = progress * 360f
        drawDeterminateCircularIndicator(startAngle, sweep, color, stroke)
    }
}
Run Code Online (Sandbox Code Playgroud)

android android-jetpack-compose

7
推荐指数
2
解决办法
7971
查看次数

获取 Widevine 许可证服务器密钥

要实现的目标:我需要像 Netflix 一样支持 android 设备上的离线视频,并使用 DRM 支持禁止其分发。

到目前为止我所做的:我使用 Shaka Packager 将示例视频转换为 m3u8 格式。使用此链接https://google.github.io/shakapackager/html/tutorials/widevine.html

面临的问题: 1. 这是否足以进行 DRM 保护?2. 我知道我必须使用许可的 Widevine 服务器,但我无法在任何地方找到有关如何获取的信息。请帮我解决这个问题。3. 我想对于第 2 点,我必须在服务器上存储一个密钥。android 设备上将使用相同的密钥来启用视频播放器。我对如何设置这个有点困惑。

提前致谢!!

android drm offline-caching widevine exoplayer

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

将自定义样式设置为 android 中自定义视图内的文本视图

我有一个自定义视图类 DoubleTextView.java 如下所示,

public class DoubleTextView extends LinearLayout {
    LinearLayout layout;
    TextView upTextView;
    TextView downTextView;
    Context mContext;

    public DoubleTextView(Context context) {

        super(context);
        mContext = context;
    }

    public DoubleTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;


        String service = Context.LAYOUT_INFLATER_SERVICE;
        LayoutInflater li = (LayoutInflater) getContext().getSystemService(service);

        layout = (LinearLayout) li.inflate(R.layout.custom_double_text, this, true);

        upTextView = layout.findViewById(R.id.text_up);
        downTextView = layout.findViewById(R.id.text_down);

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DoubleTextView);

        String upText = a.getString(R.styleable.DoubleTextView_upText);
        String downText = a.getString(R.styleable.DoubleTextView_downText);
        int upTextStyle = a.getInteger(R.styleable.DoubleTextView_styleUpText,R.style.ListOtherLightInfo);
        int downTextStyle = a.getInteger(R.styleable.DoubleTextView_styleDownText,R.style.ListOtherLightInfo);

        upText …
Run Code Online (Sandbox Code Playgroud)

java android styles android-custom-view

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