我正在使用 android.support.v7.app.AlertDialog 。但是,我无法删除divider.Can是否有人告诉我如何删除它?感谢。
这是我的风格:
Sys.setenv(SPARK_HOME = "C:/Apache/spark-1.4.1-bin-hadoop2.6")
.libPaths(c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"), .libPaths()))
library(SparkR)
sc <- sparkR.init(master = "local")
这是我的代码:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="alertDialogTheme">@style/AppTheme.Dialog.Alert</item>
</style>
<style name="AppTheme.Dialog.Alert" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/colorAccent</item>
</style>
答案 0 :(得分:1)
AlertLialog divider在pre-lollipop和棒棒糖设备中有所不同。我发现,在前棒棒糖(预材料设计)设备中,分隔色为灰色。所以它是可见的。但对于材料设计(棒棒糖)设备,分隔器颜色是透明的,因此它似乎不可见/存在。
要在所有设备上显示分隔线,请明确将颜色设置为灰色或任何其他颜色。
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
AlertDialog alertDialog = builder.create();
ListView listView = alertDialog.getListView();
listView.setDivider(new ColorDrawable(Color.GRAY));
listView.setDividerHeight(1);
alertDialog.show();
答案 1 :(得分:0)
您是否在android.support.v4.app.DialogFragment中使用AlertDialog?我总是这样使用它,我从来没有在你的屏幕上得到分隔符:
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
public class MyDialogFragment extends DialogFragment {
public static MyDialogFragment newInstance(){
return new MyDialogFragment;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
// Inflate my custom layout
View layout = inflater.inflate(R.layout.my_custom_layout, null);
// Initialize my layout components
...
// Build dialog
builder.setTitle("TITLE")
.setView(layout)
.setPositiveButton("OK", listener)
.setNegativeButton("Cancel", listener);
return builder.create();
}
}