我正在使用该fullCalendar库来添加事件.默认视图是month,我正在加载数据database.此外,无论用户选择什么,都存储在数据库中.我这里有两个问题.首先,当页面加载时,库event在同一天添加两行.其次,我想限制用户添加single event一天.因此,没有一天会有多个事件.我使用以下代码加载数据,并且还存在click事件.
$('#calendar').fullCalendar({
header: {
left : 'prev,next',
center : 'title',
},
defaultView: 'month',
defaultDate: today,
selectable: true,
navLinks: true, // can click day/week names to navigate views
selectHelper: true,/*Load all the events from the database on page load*/
events: {
//Don't have to make an ajax call because full calendar will make the call
//Error and success functions are available.
//On success we will populate the data which is …Run Code Online (Sandbox Code Playgroud) 我有一个Activity由 4 张图像和onClick我打开的任何图像组成的Fragment. 另外,我有一个Navigation Drawer配置文件选项打开一个fragment. 由于我的田地ProfileFragment很少,所以有空闲的空间。如果用户单击空白区域,则会执行放置在其中的图像的单击事件,并打开Activity该特定图像。Fragment我尝试将背景颜色设置为profilefragment,white但没有成功。
ProfileFragment类:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_profile, container, false);
ButterKnife.bind(this, view);
view.setBackgroundColor(Color.WHITE);
return view;
}
Run Code Online (Sandbox Code Playgroud)
profile_fragment.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.six30labs.mis.fragments.ProfileFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/empCompanyName"
style="@style/MyTextViewStyle"
android:hint="Company Name"
android:inputType="text" />
<EditText
android:id="@+id/empPhoneNumber"
style="@style/MyTextViewStyle"
android:hint="Employee PhNo"
android:inputType="text" …Run Code Online (Sandbox Code Playgroud) 我一直在尝试这个程序一段时间,但却无法找到合适的解决方案.例如,输入是123456由用户输入的.我想交换前两个字符,然后是接下来的两个字符,依此类推.所以,输出应该是214365.我尝试了以下代码但无法获得所需的输出.
public static void main(String[] arg$) {
Scanner in = new Scanner(System.in);
System.out.println("enter a word: ");
String str = in.nextLine();
char[] arr = str.toLowerCase().toCharArray();
char temp1, temp2;
for (int i = 0; i < arr.length; i++) {
try {
if ((i % 2) == 0) {
temp2 = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp2;
} else {
System.out.println(Arrays.toString(arr));
temp1 = arr[i + 1];
arr[i + 1] = arr[i+2];
arr[i + 2] …Run Code Online (Sandbox Code Playgroud)