解决的问题:
1.在string.xml中,可能会在Layout中显示不出来。但运行之后,还是可以看到。
2.在string.xml中,可能会出现一些错误。java.lang.NullPointerException 错误.
解决办法
菜单中选择 Window -> Preference -> General -> Startup and Shutdown
将"Usage Data Gathering Plug-in" 和"Usage Data Recording Plug-in" 的两个选项去掉.
在工程上右键-> "Properties" > "Builders" , 去掉 "Android Project Builder"
3.出现
ActivityManager: Warning: Activity not started, its current task has been brought to the front
出现这个提示的解决办法,退出模拟器中运行的程序,再次运行即可解决!
4.弄个布局的例子程序。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<!-- login -->
<LinearLayout
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/login"
android:textSize ="25px"/>
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="250px"
android:height="50px"/>
</LinearLayout>
<!-- password -->
<LinearLayout
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/password"
android:textSize="25px"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="250px"
android:height="50px"/>
</LinearLayout>
<!-- 第一行 按键 -->
<LinearLayout
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button android:layout_width="wrap_content" android:layout_height="wrap_content"
android:width="70px"
android:height="70px"
android:textSize="25px"
android:text="@string/num1"/>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content"
android:width="70px"
android:height="70px"
android:textSize="25px"
android:text="@string/num2"/>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content"
android:width="70px"
android:height="70px"
android:textSize="25px"
android:text="@string/num3"/>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content"
android:width="70px"
android:height="70px"
android:textSize="25px"
android:text="@string/num4"/>
</LinearLayout><!-- 第一行 end -->
</LinearLayout>