Android处理记录

1. [Accessibility] Missing contentDescription attribute on image

ADT提示,需要为该控件添加一个内容描述,描述该控件的作用。

解决方案:添加android:contentDescription="@string/des_iv"


2. <uses-sdk> tag should specify a target API level (the highest verified version; when running on later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?"

解决方案:<uses-sdk>添加android:targetSdkVersion="30"


3. This tag and its children can be replaced by one <TextView/> and a compound drawable

TextView带有drawableRight属性,可以指定在TextView的上下左右方位的图像资源。

解决方案:

<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/check_tv_sex"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/info" />

        <ImageView
            android:src="@drawable/male"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/des_iv" />
</LinearLayout>

更改为

<TextView
    android:id="@+id/check_tv_sex"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:drawableRight="@drawable/male"
    android:text="@string/info" />

4. 在执行StartActivity时报Source Not Found的异常:

解决方案:只是因为在AndroidManifest.xml中未声明你要跳转到的那个Activity。

在主Activity同级添加一个Activity节点:

<activity
    android:name="com.simple.NewSimpleActivity"
    android:label="@string/app_name" >
</activity>


5. Mediaplayer播放时报Should have subtitle controller already set的异常:

解决方案:将prepare改为prepareAsync,然后start方法在Prepared事件里面调用。

this.mediaPlayer.prepareAsync();
this.mediaPlayer.setOnPreparedListener(new OnPreparedListener() {
	@Override
	public void onPrepared(MediaPlayer mp) {
		mp.start();
	}
});

6.SDK更新时的“https://dl-ssl.google.com refused”

解决方案:将https://修改为http://。 在Android SDK Manager->Tools-Options...选项界面,将“Force https://… sources to be fetched using http://…”勾选。

如果还不行,则在文件(C:\Windows\System32\drivers\etc\hosts)中,添加如下几行:

203.208.46.146 www.google.com
203.208.46.146 dl.google.com 
203.208.46.146 dl-ssl.google.com



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值