GVKun编程网logo

给dedecms的checkbox多选字段自定义取值(dedecms怎么用)

24

如果您对给dedecms的checkbox多选字段自定义取值感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于给dedecms的checkbox多选字段自定义取值的详细内容,我

如果您对给dedecms的checkbox多选字段自定义取值感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于给dedecms的checkbox多选字段自定义取值的详细内容,我们还将为您解答dedecms怎么用的相关问题,并且为您提供关于Android CheckBox 修改大小、边框颜色,以及自定义 CheckBox;、Android 自定义CheckBoxPreference的CheckBox复选框、androi_checkbox多选框学习、ant-design-vue checkbox的checked不生效的有价值信息。

本文目录一览:

给dedecms的checkbox多选字段自定义取值(dedecms怎么用)

给dedecms的checkbox多选字段自定义取值(dedecms怎么用)

 

[field:字段 runphp=yes] $arr = explode(',',@me); $result = ''; for($index=0;$index<count($arr);$index++){ $result .= "<span>$arr[$index]</span>"; } @me = $result; [/field:字段]  

内容详细页标签

{dede:field.字段 runphp=yes} $arr = explode(',',@me); $result = ''; for($index=0;$index<count($arr);$index++){ $result .= "<span>$arr[$index]</span>"; } @me = $result; {/dede:field.字段}  

本文章网址:http://www.ppssdd.com/code/10630.html。转载请保留出处,谢谢合作!

Android CheckBox 修改大小、边框颜色,以及自定义 CheckBox;

Android CheckBox 修改大小、边框颜色,以及自定义 CheckBox;

CheckBox 修改大小:

android:scaleX="0.8"
android:scaleY="0.8"

CheckBox 修改边框颜色,注意不是背景色:

 android:buttonTint="@color/colorAccent"

修改大小和边框颜色:

                   <CheckBox
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:gravity="center_vertical"
                    android:scaleX="0.8"
                    android:scaleY="0.8"
                    android:buttonTint="@color/colorAccent"
                    />

自定义 CheckBox:

           <CheckBox
            android:id="@+id/spc_cb_shops"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:paddingLeft="@dimen/side_distance"
            android:paddingRight="@dimen/side_distance"
            style="@style/spc_checkbox_style"
            />
 <!--购物车checkbox-->
    <style name="spc_checkbox_style" parent="@android:style/Widget.CompoundButton.CheckBox">
        <item name="android:drawableLeft">@drawable/spc_cb</item>
        <item name="android:button">@null</item>
    </style>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@mipmap/select_button" />
    <item android:state_checked="false" android:drawable="@mipmap/select_button_gray" />
    <item android:drawable="@mipmap/select_button_gray" />
</selector>
@mipmap/select_button是已选中样式,;
@mipmap/select_button_gray是未选中样式;

Android 自定义CheckBoxPreference的CheckBox复选框

Android 自定义CheckBoxPreference的CheckBox复选框

在使用Android的Preference,有时为了让我们的界面更加美观,我们会自定义自己的Preference。今天就主要说一下怎样自定义CheckBoxPreference的CheckBox按钮。

系统默认CheckBoxPreference的CheckBox样式


自定义后的CheckBox样式


其实,关键的一步就是指定CheckBoxPreference的android:widgetLayout属性,详细步骤就不说了,下面直接上代码,很简单的。

1./res/xml/my_preference.xml

 <?xml version="1.0" encoding="utf-8"?>  
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >  
  
    <CheckBoxPreference  
        android:key="cbp"  
        android:summaryOff="Off"  
        android:summaryOn="On"  
        android:title="CheckBoxPreference"  
        android:widgetLayout="@layout/my_checkbox" />  
  
</PreferenceScreen>

2./res/layout/my_checkbox.xml

<?xml version="1.0" encoding="utf-8"?>  
<CheckBox xmlns:android="http://schemas.android.com/apk/res/android"  
    android:id="@+android:id/checkbox"  
    android:layout_width="wrap_content"  
    android:layout_height="wrap_content"  
    android:button="@drawable/checkbox_checked_style"  
    android:clickable="false"  
    android:focusable="false" />

3./res/drawable/checkbox_checked_style.xml

<?xml version="1.0" encoding="utf-8"?>  
<selector xmlns:android="http://schemas.android.com/apk/res/android">  
  
    <item android:drawable="@drawable/icon_checkbox_unchecked" android:state_checked="false"/>  
    <item android:drawable="@drawable/icon_checkbox_checked" android:state_checked="true"/>  
  
</selector>

4.MainActivity.java注意要继承PreferenceActivity

public class MainActivity extends PreferenceActivity {  
  
    @Override  
    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        addPreferencesFromResource(R.xml.my_preference);  
    }  
  
    @Override  
    public boolean onCreateOptionsMenu(Menu menu) {  
        getMenuInflater().inflate(R.menu.activity_main, menu);  
        return true;  
    }  
      
}

 

androi_checkbox多选框学习

androi_checkbox多选框学习

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

   <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
   >
      <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/allChoice"
        android:id="@+id/allChoiceCheckBox"
      />
      <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/otherChoice"
        android:layout_toRightOf="@id/allChoiceCheckBox"
        android:layout_alignTop="@id/allChoiceCheckBox"
        android:id="@+id/otherChoiceCheckBox"
      />

   </RelativeLayout>
   
    <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:gravity="center"
   >
      <CheckBox
        android:layout_width="150px"
        android:layout_height="wrap_content"
        android:text="@string/java"
        android:id="@+id/javaCheckBox"
      />
      <CheckBox
        android:layout_width="150px"
        android:layout_height="wrap_content"
        android:text="@string/php"
        android:layout_toRightOf="@id/javaCheckBox"
        android:layout_alignTop="@id/javaCheckBox"
        android:id="@+id/phpCheckBox"
      />

   </RelativeLayout>
   
    <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:gravity="center"
   >
      <CheckBox
        android:layout_width="150px"
        android:layout_height="wrap_content"
        android:text="@string/android"
        android:id="@+id/androidCheckBox"
      />
      <CheckBox
        android:layout_width="150px"
        android:layout_height="wrap_content"
        android:text="@string/oracle"
        android:layout_toRightOf="@id/androidCheckBox"
        android:layout_alignTop="@id/androidCheckBox"
        android:id="@+id/oracleCheckBox"
      />
   </RelativeLayout>
   
    <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/addCheckBox"
    >
     </RelativeLayout>
   
    <RelativeLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:gravity="center"
     android:paddingTop="20px"
   >
      <Button
        android:layout_width="150px"
        android:layout_height="wrap_content"
        android:text="@string/getValue"
        android:id="@+id/getValueButton"
      />
      <Button
        android:layout_width="150px"
        android:layout_height="wrap_content"
        android:text="@string/addDiy"
        android:layout_toRightOf="@id/getValueButton"
        android:layout_alignTop="@id/getValueButton"
        android:id="@+id/addDiyButton"
      />

   </RelativeLayout>


</LinearLayout>

上面是布局文件

下面是MainActivity.java

package com.android.checkbox.activity;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.RelativeLayout;
import android.widget.Toast;

public class MainActivity extends Activity {
   
	private CheckBox allChoiceCheckBox;
	
	private CheckBox otherChoiceCheckBox;
	
	private CheckBox javaCheckBox;
	
	private CheckBox phpCheckBox;
	
	private CheckBox androidCheckBox;
	
	private CheckBox oracleCheckBox;
	
	private Button getValueButton;
	
	private Button addDiyButton;
	
	private ArrayList<CheckBox> checkBoxList=new ArrayList<CheckBox>();
	
	
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        allChoiceCheckBox=(CheckBox) this.findViewById(R.id.allChoiceCheckBox);
        otherChoiceCheckBox=(CheckBox) this.findViewById(R.id.otherChoiceCheckBox);
        
        javaCheckBox=(CheckBox) this.findViewById(R.id.javaCheckBox);
        phpCheckBox=(CheckBox) this.findViewById(R.id.phpCheckBox);
        androidCheckBox=(CheckBox) this.findViewById(R.id.androidCheckBox);
        oracleCheckBox=(CheckBox) this.findViewById(R.id.oracleCheckBox);
        checkBoxList.add(javaCheckBox);
        checkBoxList.add(phpCheckBox);
        checkBoxList.add(androidCheckBox);
        checkBoxList.add(oracleCheckBox);
        
        getValueButton=(Button) this.findViewById(R.id.getValueButton);
        
        addDiyButton=(Button) this.findViewById(R.id.addDiyButton);
        
        // 全选
         allChoiceCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
		    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
			     for( CheckBox checkBox : checkBoxList)
		    	    {
		    	    	checkBox.setChecked(isChecked);
		    	    }
			}
		});
         //反选
         otherChoiceCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
		    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
		
		    	    for( CheckBox checkBox : checkBoxList)
		    	    {
		    	    	checkBox.setChecked(!checkBox.isChecked());
		    	    	
		    	    }
		    	    //allChoiceCheckBox.setChecked(false);
			}
		});
         
         getValueButton.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				
				  StringBuffer sb=new StringBuffer();
				    for( CheckBox checkBox : checkBoxList)
		    	    {
		    	    	 if(checkBox.isChecked())
		    	    	 {
		    	    		 sb.append(checkBox.getText()).append(",");
		    	    	 }
		    	    	
		    	    }
				    sb.deleteCharAt(sb.length()-1);
				    Toast.makeText(MainActivity.this, sb.toString(), Toast.LENGTH_SHORT).show();
			}
		});
         
         addDiyButton.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				
				RelativeLayout addCheckBox=(RelativeLayout) MainActivity.this.findViewById(R.id.addCheckBox);
			     CheckBox cb=new CheckBox(MainActivity.this);
			   //  LayoutParams  params=new LayoutParams();
			    // cb.setLayoutParams(params)
				//addCheckBox.addView(child, params)
			}
		});
    }
}


ant-design-vue checkbox的checked不生效

ant-design-vue checkbox的checked不生效

如题,参考其他博客后了解到,如果使用了 a-checkbox-group ,checked将不会生效。需要在 a-checkbox-group 上使用 checkedList 来实现默认选中。

参考文章地址:https://blog.csdn.net/qq_36987708/article/details/116460345

 我的原始代码

          <a-checkbox-group>
            <a-row>
              <a-col :span="12" v-for="item in 这是一个数组" :key="item2.value">
                <a-checkbox :value="item.值"> {{ item.描述 }} </a-checkbox>
              </a-col>
            </a-row>
          </a-checkbox-group>

修改后的代码

          <a-checkbox-group :value="checkedList">
            <a-row>
              <a-col :span="12" v-for="item in 这是一个数组" :key="item2.value">
                <a-checkbox :value="item.值"> {{ item.描述 }} </a-checkbox>
              </a-col>
            </a-row>
          </a-checkbox-group>

 就加了一个 :value="checkedList其中 checkList 是值的数组([1,2,3]这样的数组,具体看多选框的值类型)

我们今天的关于给dedecms的checkbox多选字段自定义取值dedecms怎么用的分享就到这里,谢谢您的阅读,如果想了解更多关于Android CheckBox 修改大小、边框颜色,以及自定义 CheckBox;、Android 自定义CheckBoxPreference的CheckBox复选框、androi_checkbox多选框学习、ant-design-vue checkbox的checked不生效的相关信息,可以在本站进行搜索。

本文标签: