<span style="font-size: 12px; font-family: Helvetica, Tahoma, Arial, sans-serif; background-color: rgb(255, 255, 255);">Tip 1:</span>
<span style="font-size: 12px; font-family: Helvetica, Tahoma, Arial, sans-serif; background-color: rgb(255, 255, 255);">Tip 1:</span>android开发中,出现“unfortunately,项目 has stopped” 提示#xxx not found Exception 空指针错误
原因:在mainActivity.java中设置如下
<span style="font-size:12px;">@override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContextView(R.id.msg);
}</span>
Tip 2:
组件配置正确后运行与AVD上,所有组件堆积在一起如图:
源代码:
<h1 style="box-sizing: content-box; margin: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 24px; list-style: none; padding: 0px; border: none; outline: none 0px; width: 730px; word-break: break-all; word-wrap: break-word;"><span style="font-size:14px;"><span class="title text_overflow" style="box-sizing: content-box;"></span></span><pre name="code" class="java"><span style="font-size:14px;"><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity" >
<TextView
android:id="@+id/encinfo"
android:text="请选择要使用的编码方式"
android:textSize="20px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<RadioGroup
android:id="@+id/encoding"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:checkedButton="@+id/gbk">
<RadioButton
android:id="@+id/utf"
android:text="UTF编码"
/>
<RadioButton
android:id="@+id/gbk"
android:text="GBK编码"
/>
</RadioGroup>
<TextView
android:id="@+id/sexinfo"
android:text="你的性别是"
android:textSize="20px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<RadioGroup
android:id="@+id/sex"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:checkedButton="@+id/male">
<RadioButton
android:id="@+id/male"
android:text="男"
/>
<RadioButton
android:id="@+id/female"
android:text="女"
/>
</RadioGroup>
<EditText
android:id="@+id/myet01"
style="@style/msg_style"
android:text="first EditText"
/>
<EditText
android:id="@+id/myet02"
style="@style/msg_style"
android:layout_marginTop="50dp"
android:text="second EditText"
/>
</RelativeLayout></span>
问题原因:使用的是RelativeLayout 需要定义每个组件的相对位置,用坐标或者上下左右距离标注。或者定义完基本组件后进入Graphical Layout界面编辑各组件相对位置。
或者使用LinearLayout 线性布局。在母版中使用android:oritentation="vertical" 使各大块组件垂直排列 ,然后在各组件内部使用android:orientation="horizontal" 使小组件水平排列。进而实现快速布局。
Tip 3:
基本组件
Tip 4:
公司最近做的一个项目需要推屏的硬件及软件。上网一查,其实东西挺多,价格也公道,生活中的用处也很大,明明完全可以大众化的一个产品,不知道为什么范围这么窄。当然,范围窄也是相对的,我周围的环境中机械,土木,金融的多,IT,科技行业的少可能也是一方面原因。
Tip 5:
问题:发布的app动作过程中,avd翻转。
解决办法:Ctrl+F11 翻转屏幕调整。
Tip 6:
运行后出现:emulator-5554 disconnected! Cancelling 'xxx
activity launch'! 原因是在app还没发布好久断开了avd
解决办法:启动无应用程序的空模拟器,然后在eclipse中运行我们编写的Android java程序即可,这样没有再出现模拟器断开的情况,程序正常运行!
注意:直接启动应用一般会等很长时间。可以尝试在每次开始前先启动没有项目的控模拟器,等到模拟器跳转到帮助界面或者一段时候再启动项目。成功后会进入帮助界面然后跳转到app。
本文总结了在Android基本控件学习过程中遇到的问题,包括导致'Unfortunately, 项目 has stopped'错误的原因和解决方法,特别讨论了如何处理NullPointerException。通过对这些问题的分析,旨在帮助开发者避免和解决类似问题。"
132883551,19974236,Vue 3与TypeScript实战:构建自定义加载组件,"['Vue.js', 'typescript', 'javascript', '前端开发', 'UI组件']
3342

被折叠的 条评论
为什么被折叠?



