Android小笔记(1)

本文总结了Android开发过程中遇到的各种问题及解决办法,包括dex文件打包错误修正、不同平台.so文件的作用、自定义布局Dialog的注意事项等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

笔记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规定一些属性。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值