常见小问题总结

1.多条notification任务提示,通知栏显示的任务正常,但是进入内容则总是显示第一条通知栏的内容。

问题在于PendingIntent contentIntent = PendingIntent.getActivity(Context context, int requestCode,Intent intent, int flags)中的requestcode不能相同,建议设置为对于的id


2.ExpandableListView的OnChildClickListener无效

首先设置adapter中的isChildSelectable方法返回true,如果还没有反应的话,则在getChildView方法中设置convertView.setClickable(false);即可。一般都能顺利解决


3.acitivy为android:launchMode="singleTask"时,再次跳转到该页面收不到intent值

问题描述:AActivity的lanuchMode为singleTask,跳转到B页面,然后B页面设置intent参数后,再次跳转到A页面这时候,intent的参数接收不到、

解决方案:在A页面中重写onNewIntent方法

@Override
	protected void onNewIntent(Intent intent) {
		super.onNewIntent(intent);
		setIntent(intent);
	}


4.按钮设置setPressed(true),但是按钮的背景任然没有改变。

解决方案:button.setSelected(true); 然后xml中

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_selected="false"   android:drawable="@color/transparent" />
    <item android:state_selected="true"  android:drawable="@drawable/left_slider_toogle_bt_bg_sel" />
</selector>

5.启动app,各种jar包int报错。

解决方案:把所有Referenced Libraries中的包全部删除掉,然后右键项目Android  Tools ->Fix project Properties,所有的包放到了Android Dependencies中,这时候就解决了启动各种jar包init找不到问题


6.SpannableString设置ForegroundColorSpan时有色差

old代码:

spanAuthorName.setSpan(new ForegroundColorSpan(
				color.comment_reply_username_foreground), 0, spanAuthorName
				.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
改成:

spanAuthorName.setSpan(new ForegroundColorSpan(mContext.getResources()
				.getColor(R.color.comment_reply_username_foreground)), 0,
				spanAuthorName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);


7.第二次调用AlertDialog时,报错Android AlertDialog The specified child already has a parent Exception

最初的方法:

private void popWind(View v) {
		dialog = new AlertDialog.Builder(mContext).create();
		dialog.setView(delayedPopView);
		dialog.show();
		Window window = dialog.getWindow();
		window.setGravity(Gravity.CENTER); 
		dialog.setCanceledOnTouchOutside(true);
	}
这里的delayedPopView不能设置成全部变量应该放在该方法中:

private void popWind(View v) {
		View delayedPopView = LayoutInflater.from(mContext).inflate(
				R.layout.common_notification_delayed_pop, null);
		initRadioButton(delayedPopView);
		dialog = new AlertDialog.Builder(mContext).create();
		dialog.setView(delayedPopView);
		dialog.show();
		Window window = dialog.getWindow();
		window.setGravity(Gravity.CENTER); 
		dialog.setCanceledOnTouchOutside(true);
	}
这样就解决了。



持续跟新中。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值