Java AlertDialog,复选框之间应该有一条线
我有一个Alertdialog和style is复选框,我需要在彼此之间加一条线。Java AlertDialog,复选框之间应该有一条线,java,android,checkbox,styles,android-alertdialog,Java,Android,Checkbox,Styles,Android Alertdialog,我有一个Alertdialog和style is复选框,我需要在彼此之间加一条线。 因为我的东西太多了。 谢谢你的帮助 这是我的密码 public Button.OnClickListener IMBL = new Button.OnClickListener() { public void onClick(View v) { AfterClick = new boolean[items.length]; for (int i = 0; i < Af
因为我的东西太多了。 谢谢你的帮助 这是我的密码
public Button.OnClickListener IMBL = new Button.OnClickListener() {
public void onClick(View v) {
AfterClick = new boolean[items.length];
for (int i = 0; i < AfterClick.length; i++) {
AfterClick[i] = false;
}
AlertDialog dialog = new AlertDialog.Builder(Daycarddd.this)
.setTitle("skill")
.setMultiChoiceItems(items, AfterClick,
new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog,
int indexSelected, boolean isChecked) {
if (isChecked) {
for (int i = 0; i < AfterClick.length; i++) {
if (AfterClick[i]) {
}
}
} else if (seletedItems
.contains(indexSelected)) {
// Else, if the item is already in the
// array, remove it
seletedItems.remove(Integer
.valueOf(indexSelected));
}
}
})
.setPositiveButton("confirm",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
for(int j=0;j< items.length;j++){
if(AfterClick[j]==true){
if(resultcheck==""){resultcheck=items[j];}else
resultcheck =resultcheck+","+items[j] ;
}
}
checkbox=resultcheck;
resultcheck="";
Toast.makeText(Daycarddd.this,
checkbox,
Toast.LENGTH_SHORT).show();
}
})
.setNegativeButton("cancle",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int id) {
}
}).create();
dialog.show();
}
};
public Button.OnClickListener IMBL=new Button.OnClickListener(){
公共void onClick(视图v){
AfterClick=新布尔值[items.length];
对于(int i=0;i
要绘制水平线,请使用此布局
<View
android:id="@+id/viewBorder"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"
/>
//自定义布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/mCheckbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your Check Box with border"/>
<View
android:id="@+id/viewBorder"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/mCheckbox"
android:background="@android:color/holo_red_dark"/>
//setView(视图)将设置自定义对话框视图,以便使用此布局绘制水平线
<View
android:id="@+id/viewBorder"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"
/>
//自定义布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="@+id/mCheckbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your Check Box with border"/>
<View
android:id="@+id/viewBorder"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/mCheckbox"
android:background="@android:color/holo_red_dark"/>
//setView(视图)将设置自定义对话框视图显示xmlcode@saint:我认为您应该创建自定义布局:)像这条红线为什么需要这条红线?因为我有25个复选框,但是它们是不同的类。显示您的xmlcode@saint:我认为您应该创建自定义布局:)像这条红线为什么需要这条红线?因为我有25个复选框,但它们是不同的类。如何添加此视图?如何添加此视图?