Reputation: 23
How can i make a view like this at bottom of screen ? I can make a view with round border but what about the green shadow ?
Upvotes: 0
Views: 225
Reputation: 143
you can get colored shadow using carbon
https://github.com/ZieIony/Carbon
add the following line to dependencies:
api 'tk.zielony:carbon:0.16.0.1'
add language compatibility options to build.gradle:
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
add data binding support to build.gradle:
android {
...
dataBinding {
enabled = true
}
}
to use Carbon with ProGuard add the following rules to your ProGuard:
-dontwarn carbon.BR
-dontwarn carbon.internal**
-dontwarn java.lang.invoke**
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
you can find the following image and code in carbon's github:
code:
<carbon.widget.LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<carbon.widget.Button
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_margin="@dimen/carbon_padding"
android:background="#ffffff"
app:carbon_cornerRadius="2dp"
app:carbon_elevation="8dp"
app:carbon_elevationShadowColor="@color/carbon_red_700"/>
</carbon.widget.LinearLayout>
cardview:
<carbon.widget.LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<carbon.widget.LinearLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_margin="@dimen/carbon_margin"
android:background="#ffffff"
app:carbon_cornerRadius="2dp"
app:carbon_elevation="8dp"
app:carbon_elevationShadowColor="@color/carbon_red_700">
<carbon.widget.ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:src="@drawable/test_image"/>
<carbon.widget.TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test text"/>
</carbon.widget.LinearLayout>
</carbon.widget.LinearLayout>
Upvotes: 2