您的位置:首页 > 移动开发 > Android开发

Android小笔记(1)

2015-12-10 17:01 459 查看
笔记1:
Unable to execute dex: Cannot merge new index 65879 into a non-jumbo instruction!
Conversion to Dalvik format failed: Unable to execute dex: Cannot merge new index 65879 into a non-jumbo instruction!
遇到这种情况:project.properties文件中增加一句
dex.force.jumbo=true  可以打包运行通过。

笔记2:
libs下的用于新浪微博的armeabi、x86、mips中.so文件  对于不同平台apk的安装起着重要的作用。删掉后有些手机会导致安装不成功。

笔记3: url要换下    QQ空间分享后图文并茂才能刷屏

笔记4: QQ空间不用到任何ID和Key      QQ分享用到的是 app ID 而不是app Key

笔记5: sp大小12sp以上。最好都用偶数,且建议12sp、14sp、16sp、18sp、22sp

笔记6:Activity中Theme.DeviceDefault.Light.Dialog.NoActionBar等属性会影响app默认对话框“确定”、“取消”的按钮左右位置

笔记7:

AndroidManifest.xml文件中界面对应的<activity>里加入

android:windowSoftInputMode="adjustPan"   键盘就会覆盖屏幕

android:windowSoftInputMode="stateVisible|adjustResize"   屏幕整体上移

笔记8:

自定义布局Dialog,如果android:layout_alignParentBottom=“true"
有此属性的话,Dialog的布局高度无法控制。

笔记9:

 android:textAllCaps="false"字体小写  为true字体大写,如果不填写此属性不同手机系统表现不一致。

笔记10:

Android 自定义的xmlns其实很简单,语法规则是:在使用到自定义View的xml布局文件中需要加入xmlns:前缀=http://schemas.android.com/apk/res/你的应用程序包路径.下面是一个简单的例子:



public class MyView extends TextView {
private String mString = "Welcome to Kesion's blog";

public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyView);
int textColor = a.getColor(R.styleable.MyView_textColor, 0XFFFFFFFF);
float textSize = a.getDimension(R.styleable.MyView_textSize, 36);
mString = a.getString(R.styleable.MyView_title);
setText(mString);
setTextSize(textSize);
setTextColor(textColor);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:test="http://schemas.android.com/apk/res/kexc.myView"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<kexc.myView.MyView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<span style="color:#ff0000;"> test:title="wo shi text"
test:textSize="20px"
test:textColor="#fff" </span>
/>
</LinearLayout>


即可以以test开头给自定义View规定一些属性。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息