我想在提醒對話框中添加陰影效果。 i want this type of shadow effect in my dialog box 這裏我張貼的3個文件首先是style.xml二是theme.java或第三個文件是demo_bg.xml file.i已經嘗試這樣如何在提醒對話框中添加陰影效果android
Style.xml
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/bg_color</item>
<item name="android:textColorPrimary">@color/colorBlack</item>
<item name="android:background">@drawable/demo_bg</item>
</style>
theme.java
final AlertDialog.Builder builder =
new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle);
builder.setMessage(R.string.wsdialogdata);
builder.setPositiveButton("START", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent ii = new Intent(WelcomeFromActivity.this, Question1Activity.class);
startActivity(ii);
}
});
builder.show();
demo_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<!-- SHADOW LAYER -->
<item android:left="2dp" android:top="2dp">
<shape>
<solid android:color="#66000000" />
<corners android:radius="35dip" />
</shape>
</item>
<!-- CONTENT LAYER -->
<item android:bottom="4dp" android:right="4dp">
<shape>
<solid android:color="@color/btn_fb" />
<corners android:radius="40dip" />
</shape>
</item>
</layer-list>
</item>
</selector>
你的demo_bg是什麼? –
最簡單的方法是創建自己的佈局,並使佈局的CardView'根元素 –
它是一個影子文件@RahulDevanavar –