【问题标题】:What is the correct way to install the Carbon library for Android?为 Android 安装 Carbon 库的正确方法是什么?
【发布时间】:2020-06-16 02:10:35
【问题描述】:

克隆 Carbon 库存储库以用于 android 项目:

https://github.com/ZieIony/Carbon

在我的 gradle 上安装依赖:

api 'tk.zielony:carbon:0.16.0.1'

同时添加其他设置:

 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

但是在实现阴影效果的那一刻,它没有显示在我的项目中;唯一的就是一个黑色阴影,就好像它是一个普通的卡片视图,而不是一个自定义颜色的阴影:

    <carbon.widget.Button
        android:layout_width="56dp"
        android:layout_height="56dp"
        android:layout_margin="@dimen/carbon_padding"
        android:background="#ffffff"
        app:carbon_cornerRadius="28dp"
        app:carbon_elevation="8dp"
        app:carbon_elevationShadowColor="@color/carbon_blue_700" />

它看起来已经编译了

应该是这样的

我做错了什么?

谢谢!

【问题讨论】:

    标签: java android kotlin mobile material-design


    【解决方案1】:

    使用carbon.widget.LinearLayout为我工作

    <carbon.widget.LinearLayout
      android:layout_width="56dp"
      android:layout_height="56dp"
      android:layout_margin="@dimen/carbon_padding"
      android:background="#ffffff"
      app:carbon_cornerRadius="28dp"
      app:carbon_elevation="8dp"
      app:carbon_elevationShadowColor="@color/carbon_blue_700"
      />
    

    【讨论】:

      猜你喜欢
      • 2011-12-31
      • 2015-04-01
      • 2020-11-22
      • 2019-11-11
      • 1970-01-01
      • 1970-01-01
      • 2014-10-04
      • 2020-04-09
      • 2012-09-20
      相关资源
      最近更新 更多