目前分類:Android筆記 (435)

瀏覽方式: 標題列表 簡短摘要
如果要在手機發開時在PK內放置HTML檔案,程式再藉由WEBVIEW讀取的話。並須把所需檔案放在asset資料夾內。

而在設置路徑時的字串如下
file:///android_asset/mobileWeb/index.html

戮克 發表在 痞客邦 留言(0) 人氣()

想要設定ANDROID程式在安裝時要安裝於手機或著額外的SD卡上要去AndroidManifest.xml檔案manifest屬性設定android:installLocation。

android:installLocation

 android:installLocation=["auto" | "internalOnly" | "preferExternal"] 
官方說明






Value Description
"internalOnly" The application must be installed on the internal device storage only. If this is set, the application will never be installed on the external storage. If the internal storage is full, then the system will not install the application. This is also the default behavior if you do not define android:installLocation.
"auto" The application may be installed on the external storage, but the system will install the application on the internal storage by default. If the internal storage is full, then the system will install it on the external storage. Once installed, the user can move the application to either internal or external storage through the system settings.
"preferExternal" The application prefers to be installed on the external storage (SD card). There is no guarantee that the system will honor this request. The application might be installed on internal storage if the external media is unavailable or full. Once installed, the user can move the application to either internal or external storage through the system settings.

戮克 發表在 痞客邦 留言(0) 人氣()

專案匯入的時候發生以下錯誤

Description Resource Path Location Type The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project       Unknown Java Problem

原因:新的IDE環境沒有專案所需的SDK

解決方式下載之前環境的SDK版本,等錯誤消失在更換SDK版本。

戮克 發表在 痞客邦 留言(0) 人氣()

今天打開ECLIPSE專案發生錯誤
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

ECLIPSE系統本身的問題
可能的解決方式有3

1.重開ECLIPSE
2.重新設定JDK等路徑
3.刪掉專案重新匯入

戮克 發表在 痞客邦 留言(0) 人氣()

官方BUG無解
重新下載玩最新版的ECLIPSE不要更新
再去HELP->安裝新軟體
安裝ADT套件
再裝其他更新便可以使用

戮克 發表在 痞客邦 留言(0) 人氣()

新版的Eclipse沒有NDK的設定
要去下載外掛才能使用
1.先到http://developer.android.com/sdk/installing/installing-adt.html
下載外掛安裝

2.再到HRLP->Install New Software安裝完後

3.重開

4.WINDOWS->偏好設定

戮克 發表在 痞客邦 留言(0) 人氣()

原來註解
  <!--  YY--OO -->
發生The string "--" is not permitted within comments.
問題原因中間不能用
--
改成
 <!--  YYOO -->
即可

戮克 發表在 痞客邦 留言(0) 人氣()

以下透明間距  

<ListView
        android:id="@+id/lv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:cacheColorHint="#00000000"
        android:divider="#00ffffff"
        android:dividerHeight="5dp"
        android:padding="2dp" >

戮克 發表在 痞客邦 留言(0) 人氣()

Drawable drawablea;
 drawablea= getResources().getDrawable(R.drawable.check_a);

/// 這行一定要加.
drawablea.setBounds(0, 0, drawablea.getMinimumWidth(), drawablea.getMinimumHeight());


button5m.setCompoundDrawables(drawablea, null, null, null);
--------------------------------------------------------------
setCompoundDrawables(左, 上, 右, 下);

戮克 發表在 痞客邦 留言(0) 人氣()

問題
Wrong orientation? No orientation specified, and the default is horizontal, yet this layout has multiple children where at
least one has layout_width="match_parent"
解決方式
在出問題的layout

加上
 android:orientation="horizontal"

android:orientation = "vertical"
看錯誤訊息是缺什麼就加什麼

戮克 發表在 痞客邦 留言(0) 人氣()

res\layout\ m05e.xml: Invalid file name: must contain only [a-z0-9_.]

發生原因:不符合命名規格
解決方式:依照[a-z0-9_.]規則重新命名

戮克 發表在 痞客邦 留言(0) 人氣()


Intent intent=new Intent(Intent.ACTION_SEND);  
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_SUBJECT,textViewtitle.getText());
intent.putExtra(Intent.EXTRA_TITLE, "摩妃時尚");
intent.putExtra(Intent.EXTRA_TEXT, "http://www.77shoes.com/");
Bitmap bitmap;
try {
URL url =
new URL(imageurl);

戮克 發表在 痞客邦 留言(0) 人氣()

最近改程式執行時出現以下錯誤

10-21 11:13:12.337: E/AndroidRuntime(8245): java.lang.IllegalStateException: ImageLoader must be init with configuration before using
10-21 11:13:12.337: E/AndroidRuntime(8245): at com.nostra13.universalimageloader.core.ImageLoader.checkConfiguration(ImageLoader.java:560)
10-21 11:13:12.337: E/AndroidRuntime(8245): at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:206)
10-21 11:13:12.337: E/AndroidRuntime(8245): at com.nostra13.universalimageloader.
最後發現是把初始化那段刪掉忘了補回來
寫上去就OK了

戮克 發表在 痞客邦 留言(0) 人氣()

Bundle bundle ;

bundle = getIntent().getExtras();

if(bundle != null ){
動作
}

戮克 發表在 痞客邦 留言(0) 人氣()

A的ACTIVITY要切換到B的ACTIVITY,用法是使用Intent。傳遞餐屬使用putExtra方法。如以下

Intent intent = new Intent(A.this, B.class);
intent.putExtra("sex", sex);
intent.putExtra("selectType", selectType);
startActivity(intent);


而B的ACTIVITY切收資料方式如下。
private int sex;

戮克 發表在 痞客邦 留言(0) 人氣()

讓TextView顯示HTML格式文字,測試用<span style="color: #783f04;">無法改變顏色。最後用<font color="#996666">來顯示顏色。

private TextView textViewm0401h;
String HTMLSTRING="<div><b><font size=\"5\"><font color=\"#996666\">抗壓反彈元件 " +
"</font>&nbsp;</font></b></div><div>具有絕佳彈性吸震效果,可以分擔前掌區及中足區的壓力" +
",均衡壓力的絕佳效果。</div><div><br></div><div><b><font size=\"5\" " +
"color=\"#996666\">吸震緩衝元件</font></b></div><div>彈性極佳的材質具有吸震" +
"緩衝效果,能夠減緩足弓、腳跟所受到的衝擊力!</div><div><br></div><div><b><font " +
"size=\"5\" color=\"#996666\">穩定支撐元件</font></b></div><div>有高" +
"度的支撐力,可以穩固支撐抵抗足部壓力,讓足跟不承受過大的壓力。</div>";

戮克 發表在 痞客邦 留言(0) 人氣()

String htmlq="<div><font color=\"#996633\"><b></div><div>";

AlertDialog.Builder showRightorNot = new AlertDialog.Builder(M0102.this);
showRightorNot.setPositiveButton("了解", null);
showRightorNot.setTitle("影響物準確度的原因");
showRightorNot.setMessage(Html.fromHtml(htmlq)).show();

戮克 發表在 痞客邦 留言(0) 人氣()

設定按鈕事件

ImageView bkind2 = (ImageView) findViewById(R.id.imageView2kind);
bkind2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {

}

});

戮克 發表在 痞客邦 留言(0) 人氣()


 public Bitmap doodle(Bitmap bitmap0,Bitmap bitmap1)
{
Matrix matrix = new Matrix();
matrix.postRotate(0); //旋轉角度

int width = bitmap0.getWidth();
int height = bitmap0.getHeight();
bitmap0 = Bitmap.createBitmap(bitmap0, 0, 0, width, height, matrix, true);

戮克 發表在 痞客邦 留言(0) 人氣()

最近在使用一個LAYOUT家個背景圖但圖片一職無法顯示。我只有一張圖大圖我把它放到drawable資料夾裡而已,沒有依不同尺寸各別放。然後執行一直無法顯示整個專案CLEAR再重新建立都一樣。最後靈光一動把所有資料夾都丟入同一張圖片。執行就OK了。猜測是ECLIPSE系統BUG。

戮克 發表在 痞客邦 留言(0) 人氣()