導航:首頁 > 操作系統 > androidsamples下載

androidsamples下載

發布時間:2023-03-02 15:31:06

Ⅰ 如何在win7上搭建android cocos2d-x-3.3開發環境

android平台工程創建

1、android SDK+NDK安裝

1)、安裝java jdk(如果已經安裝了,可以不用此步驟)

進入:http://www.oracle.com/technetwork/java/javase/downloads/index.html或者直接點擊下載。如下圖

(7)安裝完成後,點擊Yes按鈕,重啟Eclipse。

選擇android SDK解壓後的目錄(ADT 18 默認會掃描電腦,找到並配置好SDK位置)。

配置cygwin

命令行中進入cygwin目錄,並執行cygwin.bat,如果不是用Administrator賬號登錄的系統,那麼會在cygwinhome文件夾中生成一個以登錄名命名的新的文件夾。

修改新生成文件夾中的「.bash_profile 」文件,用UE或editplus等文本編輯器打開,在最後增加: (e/android-ndk-r8-windows/android-ndk-r8是安裝ndk的路徑)

NDK_ROOT=/cygdrive/e/android-ndk-r8-windows/android-ndk-r8

export NDK_ROOT

然後保存關閉。

至此便基本搭建完畢cocos2d-x的windows 7 android 環境

Ⅱ 到如了v4怎麼android.support.annotation

新版本的v4包有android.support.annotation的包,有的話很幸運使用這些註解的話就不會出錯,但是舊版本的沒有這個包就很悲劇了,比如我.....

現總結一下方法解決這些問題:

1、更新SDK

2、替換v4包

3、導入android-support-annotations.jar的jar。這個jar可以從網路上下載,也可以從sdk安裝目錄下(E:\InstallPath\sdk\extras\android\support\samples\annotations)找到,沒有的話就去下載吧,這個也有新的和舊的區分

Ⅲ 我想找找Android 開發的源碼例子,在www.apkbus.com 找到一些,但是我知道除了安卓巴士還有其他的網站

SDK目錄下就有很多啊,幾乎包含了所有方面的例子.
我用的2.1版SDK,例子就在samples\android-7下面,android-7就是2.1版的.
如果你用的其它版本就找到對應版本就行了.

Ⅳ 如何獲取webView上的部分內容

The extensive Android SDK allows you to do many great things with particular views like the WebView for displaying webpages on Android powered devices
Android SDK 的擴展通過使用特定的view允許你做許多事情比如WebView用來在Android手機上展示網頁
As of lately while I was experimenting with the Android SDK I was using a WebView in one of my activities
最近我在體驗Android SDK的時候在一個Activity中用到了WebView
From that particular WebView I needed to know the ContentHeight but also the ContentWidth
從WebView我不但想要知道ContentHeight還想知道ContentWidth
Now getting the contentHeight is easy like so:
現在的情況是獲取contentHeight很easy如下
webviewgetContentHeight();
Unfortunately getting the contentWidth from a WebView is rather more difficult since there is not a simple method like:
不幸的是從一個WebView獲取contentWidth是相當困難因為SDK中沒有一個像這樣的方法
// THIS METHOD DOES NOT EXIST!
webviewgetContentWidth();
There are ways to get the contentWidth of the rendered HTML page and that is through Javascript If Javascript can get it for you then you can also have them in your Java code within your Android App
當然是有方法獲取contentWidth的就是通過Javascript來獲取如果你能夠支持Javascript那麼你就可以在你的Android 程序中使用java代碼來獲取寬度
By using a JavascriptInterface with your WebView you can let Javascript communicate with your Android App Java code by invoking methods on a registered object that you can embed using the JavascriptInterface
通過在你的WebView中使用JavascriptInterface通過調用你注冊的JavascriptInterface方法可以讓Javascript和你的Android程序的java代碼相互連通
So how does this work?
怎麼做呢?
For a quick example I created a simple Activity displaying a webview that loads a webpage wich displays a log message and a Toast message with the contentWidth wich was determined using Javascript Note that this happens AFTER the page was finished loading because before the page is finished loading the width might not be fully rendered Also keep in mind that if there is content loaded asynchronously that it doesnt affect widths (most likely only heights will be affected as the width is almost always fully declared in CSS files unless you have a % width webpage)
搭建一個快速的例子創建一個簡單的展示webView的Activity一個LogCat消息一個Toast消息用來顯示我們通過 Javascript獲取的寬度注意這些會在網頁完全載入之後顯示因為在網頁載入完成之前寬度可能不能夠正確的獲取到同時也要注意到如果是異 步載入這並不影響寬度(最多高度會受影響因為寬度總是在CSS文件中做了完全的定義除非在網頁中你用了%寬度)
Below is the code of the Activity Mainjava:
下面的代碼是Activity的代碼
package ;
import androidappActivity;
import androidosBundle;
import androitilLog;
import androidwebkitWebView;
import androidwebkitWebViewClient;
import androidwidgetToast;
publicclass Main extends Activity {
privatefinalstatic String LOG_TAG = "WebViewContentWidth";
privatefinal Activity activity = this;
privatestaticint webviewContentWidth = ;
privatestatic WebView webview;

/** Called when the activity is first created */
@Override
publicvoid onCreate(Bundle savedInstanceState) {
superonCreate(savedInstanceState);
setContentView(Rlayoutmain);
webview = (WebView) findViewById(Ridwebview);
webviewgetSettings()setJavaScriptEnabled(true);
webviewsetSaveEnabled(true);
webviewaddJavascriptInterface(new JavaScriptInterface() "HTMLOUT");
webviewsetWebViewClient(new WebViewClient() {
@Override
publicvoid onPageFinished(WebView view String url) {
webviewloadUrl("javascript:windowHTMLOUTgetContentWidth(documentgetElementsByTagName(html)[]scrollWidth);");
}
});
webviewloadUrl(";);
}

class JavaScriptInterface {
publicvoid getContentWidth(String value) {
if (value != null) {
webviewContentWidth = IntegerparseInt(value);
Logd(LOG_TAG "Result from javascript: " + webviewContentWidth);
ToastmakeText( activity
"ContentWidth of webpage is: " +
webviewContentWidth +
"px" ToastLENGTH_SHORT)show();
}
}
}
}
Below is the XML layout used with the Activity wich only contains a simple WebView:
下面是Activity的Layout主要就是一個簡單的WebView
<?xml version="" encoding="utf"?>
<LinearLayout
xmlns:android=";
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
AndroidManifestxml layout:
AndroidManifestxml代碼
<?xml version="" encoding="utf"?>
<manifest
xmlns:android=";
package=""
android:versionCode="" android:versionName="">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name="Main"
android:label="@string/app_name">
<intentfilter>
<action android:name="androidintentactionMAIN" />
<category
android:name="androidintentcategoryLAUNCHER" />
</intentfilter>
</activity>
</application>
<usessdk android:minSdkVersion="" />
<usespermission android:name="androidpermissionINTERNET" />
</manifest>
You can also download the full source of Android Application WebViewContentWidth!

Ⅳ android apidemo在哪

apidemo文件存放位置是在sdk路徑下面,具體如下:
首先,導入API Demos。File->new->project->Android project->Creat project from existing source 選擇API Demos.
導入的文件可以在sdk的文件裡面找到,如XXX/android-8/samples.也可以直接下載如http://dl-ssl.google.com/android/repository/samples-2.2_r01-linux.zip

閱讀全文

與androidsamples下載相關的資料

熱點內容
php獲取上個月時間戳 瀏覽:574
怎麼設置oppo手機app密碼 瀏覽:360
jra格式下載哪個文件夾 瀏覽:658
蘋果手機怎麼刪除手機上的app 瀏覽:343
單片機熱敏電阻溫度控制 瀏覽:82
方舟私人伺服器的服主怎麼刷物資 瀏覽:454
重裝系統提示加密鎖 瀏覽:625
為什麼下載的音樂要加密 瀏覽:964
因為沒有打開的文檔所以這一命令無效 瀏覽:720
電腦文件夾數據損壞 瀏覽:716
java打賞源碼搭建 瀏覽:365
pdf32 瀏覽:256
植發加密100天效果 瀏覽:959
離心壓縮機檢修規程 瀏覽:432
如何收聽安卓手機發來的鏈接 瀏覽:401
福建微法院app怎麼用 瀏覽:210
android陀螺儀應用 瀏覽:721
新加坡加密貨幣騙局 瀏覽:912
電腦文件夾打開自動變為全屏 瀏覽:971
簡易單斷面計演算法 瀏覽:852