2016年3月10日Android实习日记
2016-03-10 08:04
357 查看
待解决问题:
*1:内部ScrollView与外部手势事件滑动冲突问题。
*2:Linearlayout+View+LinearLayout横向排列,这其中两个LinearLayout内部各有3个竖向排列的TextView,这3个TextView的居中问题。
今天解决的问题:
1.
//
private static Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
for (int i = 0; i < eList.getExaminationCount(); i++) {
Question question = new Question();
question.setAnswer(eList.getExamination(i).getTrueanswer());
... ...
question.setExplain(eList.getExamination(i).getExplain());
QuestionList.add(question);
}
};
};
//
public class ExamListRecv extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("EXAMLIST")) {
handler.sendEmptyMessage(0);
}
}
}
激活BroadcastReceiver 为新的进程(包括线程),所以会向UI线程发送消息,更新UI。
2.同事的写法。Toast.makeText(getApplicationContext(), "已经连接", 200).show();
3.还没从数据库加载完成就执行自定义的init()操作导致出现InvocationTargetException异常和数组越界。
4.将工程从Eclipse转移到Android Studio上时,出现Execution failed for task 'app:mergeDebugResources' Crunching Cruncher…png failed错误,主要是图片问题,格式不对,把原来的图片用画图工具打开,然后重新另存为就好了。若出现Error:Execution failed for task ':ProjectName:mergeDebugResources'. > Crunching Cruncher *some file* failed, see logs。重启一下Android Studio就好了。重新运行,会提示签名不一样,会把原来的程序卸载掉,终于又回到了Android Studio这么爽的平台,加油。
可以再参考:在你的主工程文件夹里的build.gradle文件里,加上下面这两句:
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
参考:https://segmentfault.com/q/1010000002634455
5.protobuf工具学习使用。
6.在我们运用Android 官方新的Gradle构建方式build后的存在于app/build/apk文件夹下会发现有app-debug-unaligned.apk,那么这个apk是什么作用呢?
实际上分为两个过程,这个unaligend仅仅是个中间产物(intermediate product).
- 1.生成unaligned APK.
- 2.unaligned APK变为aligned,并且产生aligned APK.
参考:http://www.gimoo.net/t/1502/54ed73019d10b.html
解决的问题2:
*1:内部ScrollView与外部手势事件滑动冲突问题。
*2:Linearlayout+View+LinearLayout横向排列,这其中两个LinearLayout内部各有3个竖向排列的TextView,这3个TextView的居中问题。
今天解决的问题:
1.
//
private static Handler handler = new Handler() {
public void handleMessage(android.os.Message msg) {
for (int i = 0; i < eList.getExaminationCount(); i++) {
Question question = new Question();
question.setAnswer(eList.getExamination(i).getTrueanswer());
... ...
question.setExplain(eList.getExamination(i).getExplain());
QuestionList.add(question);
}
};
};
//
public class ExamListRecv extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("EXAMLIST")) {
handler.sendEmptyMessage(0);
}
}
}
激活BroadcastReceiver 为新的进程(包括线程),所以会向UI线程发送消息,更新UI。
2.同事的写法。Toast.makeText(getApplicationContext(), "已经连接", 200).show();
3.还没从数据库加载完成就执行自定义的init()操作导致出现InvocationTargetException异常和数组越界。
4.将工程从Eclipse转移到Android Studio上时,出现Execution failed for task 'app:mergeDebugResources' Crunching Cruncher…png failed错误,主要是图片问题,格式不对,把原来的图片用画图工具打开,然后重新另存为就好了。若出现Error:Execution failed for task ':ProjectName:mergeDebugResources'. > Crunching Cruncher *some file* failed, see logs。重启一下Android Studio就好了。重新运行,会提示签名不一样,会把原来的程序卸载掉,终于又回到了Android Studio这么爽的平台,加油。
可以再参考:在你的主工程文件夹里的build.gradle文件里,加上下面这两句:
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
参考:https://segmentfault.com/q/1010000002634455
5.protobuf工具学习使用。
6.在我们运用Android 官方新的Gradle构建方式build后的存在于app/build/apk文件夹下会发现有app-debug-unaligned.apk,那么这个apk是什么作用呢?
实际上分为两个过程,这个unaligend仅仅是个中间产物(intermediate product).
- 1.生成unaligned APK.
- 2.unaligned APK变为aligned,并且产生aligned APK.
参考:http://www.gimoo.net/t/1502/54ed73019d10b.html
解决的问题2:
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerHorizontal="true" android:layout_marginLeft="10dp" android:gravity="center" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="题友出错率" android:textColor="@color/exam_small_size" android:textSize="@dimen/exam_detail_tiyou_font_size" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5.9%" android:textColor="#FF0000" android:textSize="40sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="据统计5.9%的人做错过" android:textColor="@color/exam_small_size" android:textSize="@dimen/exam_detail_tiyou_font_size" /> </LinearLayout> <View android:layout_width="1px" android:layout_height="70dp" android:layout_centerHorizontal="true" android:background="#C4C4C4" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerHorizontal="true" android:layout_marginRight="10dp" android:gravity="center" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="我的出错率" android:textColor="@color/exam_small_size" android:textSize="@dimen/exam_detail_tiyou_font_size" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="100.0%" android:textColor="#FF0000" android:textSize="40sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="我做错1次,做对0次" android:textColor="@color/exam_small_size" android:textSize="@dimen/exam_detail_tiyou_font_size" /> </LinearLayout>
相关文章推荐
- android 自定义RadioButton样式
- Android 动画,看完这些就够了
- 【android】在Activity中重写onNewIntent方法
- Android开发实践:Java层与Jni层的数组传递
- 【android】IntentService
- 学习Android JNI开发笔记
- android 消息机制
- Android,IOS手机恢复用实力说话
- 实现键盘弹出时,显示Emoji按钮的功能
- 下拉刷新、上拉加载更多控件实现原理及解析(一)
- 下拉刷新、上拉加载更多控件实现原理及解析(二)
- Android自定义控件前言
- Android组合控件
- Android背景渐变色(shape,gradient)
- Android Studio引用mipmap中引用.9图片报错
- 杀人诛心 解读Android违反开源协议案
- Android需要精通的技能总结
- 《Android开发艺术探索》读书笔记 (6) 第6章 Android的Drawable
- android的上下文菜单和上下文操作模式
- android.content.res.Resources$NotFoundException错误处理