我看到了很多關於使用Phonegap開發應用程序時在Stackoverflow上發佈的關於兩個html頁面之間的小故障/間隔/間隙的問題。我找到了一個用於phonegap的插件slider plugin。搜索了很多之後,我無法弄清楚如何執行該步驟3.如何獲得手機中的幻燈片切換?
Add the import for your resource Java file (yourpackage.R) to LoadingSpinner.java
這是一些東西,在我看來,像一個原生代碼,我無法理解。
我的問題是:
- 這是什麼yourpackage.R文件?
- 它在哪裏?
- 以及如何做到那裏給出的第3步?
感謝
----------- -----------編輯
這裏是R.java
的內容package com.somethingsomething.appone;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f060001;
public static final int hello=0x7f060000;
}
public static final class style {
public static final int loading_spinner=0x7f050000;
}
public static final class xml {
public static final int cordova=0x7f040000;
public static final int plugins=0x7f040001;
}
}
和LoadingSpinner.java的含量是
package de.sandstein.phonegap.plugin.transition;
import android.app.Dialog;
import android.content.Context;
import android.view.ViewGroup.LayoutParams;
import android.widget.ProgressBar;
public class LoadingSpinner extends Dialog {
public static LoadingSpinner show(Context context, CharSequence title,
CharSequence message) {
return show(context, title, message, false);
}
public static LoadingSpinner show(Context context, CharSequence title,
CharSequence message, boolean indeterminate) {
return show(context, title, message, indeterminate, false, null);
}
public static LoadingSpinner show(Context context, CharSequence title,
CharSequence message, boolean indeterminate, boolean cancelable) {
return show(context, title, message, indeterminate, cancelable, null);
}
public static LoadingSpinner show(Context context, CharSequence title,
CharSequence message, boolean indeterminate,
boolean cancelable, OnCancelListener cancelListener) {
LoadingSpinner dialog = new LoadingSpinner(context);
dialog.setTitle(title);
dialog.setCancelable(cancelable);
dialog.setOnCancelListener(cancelListener);
/* The next line will add the ProgressBar to the dialog. */
dialog.addContentView(new ProgressBar(context), new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
dialog.show();
return dialog;
}
public LoadingSpinner(Context context) {
super(context, R.style.loading_spinner);
}
}
進口R.java在LoadingSpinner.java作爲
import android.R;
現在的錯誤狀態
loading_spinner cannot be resolved or is not a field
----------- ---------編輯 -
文件LoadingSpinner.java取代android.R通過com.somethingsomething.appone.R作爲
import com.somethingsomething.appone.R;
仍然錯誤狀態
loading_spinner cannot be resolved or is not a field
清理項目並重新啓動eclipse,錯誤消失。
用法說
1) Call initTransition() on startup of the app.
2) Call showLoadingView() to show the loading view. (Android: can use parameter "animation" ('slide' oder 'fade'))
3) When the animation has finished 'transitionAnimationReady' is fired.
4) Call hideLoadingView() to hide the loading view.
我在哪裏可以找到這些聲明的全局函數,以便它適用於所有文件的地方。
它應該在其他文件中,在html標記上方的html文件中,在頭標記中。試過把下面的代碼放在html和head標籤中。
<script type="text/javascript" charset="utf-8" src="transition.js"></script>
<script type="text/javascript">
initTransition();
showLoadingView('slide');
hideLoadingView();
alert("hi");
</script>
「進口com.somethingsomething.appone.R;」因爲你在做什麼會使用android的默認R.java。 – 2012-04-16 13:31:00
這個插件可以用於phonegap 2.2.0 – Udo 2014-03-17 06:55:47