编写Android遇到的问题和解决方法
一、Android程序的简单代码的步骤
1、创建一个Android project
2、在res文件夹下的layout和values下创建分别建立main.xml和strings.xml
3、在创建的AVD下运行所创建的项目
二、Android小程序分享
1、 创建了一个lanyao的Android项目
2、生成的.java文件
package com.cn;

import android.app.Activity;
import android.os.Bundle;

public class LanyaoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
3、main.xml的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redground"
android:orientation="vertical" >







<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redground"
android:text=" 欢迎进入Android的世界" />




<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redground"
android:text="按钮" />

<MultiAutoCompleteTextView
android:background="@color/redground"
android:id="@+id/multiAutoCompleteTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="队名:似水年华" >

<requestFocus />
</MultiAutoCompleteTextView>


<MultiAutoCompleteTextView
android:id="@+id/multiAutoCompleteTextView4"
android:layout_width="363dp"
android:layout_height="wrap_content"
android:background="@color/redground"
android:ems="10"
android:text=" 队长:郝一肖" />

<MultiAutoCompleteTextView
android:background="@color/redground"
android:id="@+id/multiAutoCompleteTextView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text=" 我们团队的那些事" />

<MultiAutoCompleteTextView
android:background="@color/redground"
android:id="@+id/multiAutoCompleteTextView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text=" 团队的照片" />

<TableRow
android:background="@color/redground"
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

</TableRow>


<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redground" />

<MultiAutoCompleteTextView
android:id="@+id/multiAutoCompleteTextView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redground"
android:ems="10"
android:text=" Android的世界精彩无限!!" />


<ImageButton
android:id="@+id/imageButton1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redground"
android:src="@drawable/ic_launcher" />
</LinearLayout>
4、color.xml的代码
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="redground">#3500ffff</color>
</resources>
5、string.xml的代码
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="hello">Hello World, LanyaoActivity!</string>
<string name="app_name">Lanyao</string>

</resources>
5、运行的结果


三、写程序遇到的问题
color.xml 不能运行成功
四、解决方法
1、问老师
2、自己修改运行,查看出错的原因
3、查百度


更多相关文章

  1. Android上oprofile使用说明
  2. AnDroidDraw.apk的安装
  3. android TextView添加滚动条
  4. Android—Service详解—模拟点击抽奖(2020.7.3)
  5. Android上oprofile使用说明
  6. Android(安卓)4.0源码放出
  7. 性能优化之Java(Android)代码优化
  8. Android(安卓)Studio试用说明
  9. 【Android(安卓)界面效果42】如何自定义字体

随机推荐

  1. 详解GaussDB(DWS) explain分布式执行计划
  2. SQL server 自增ID--序号自动增加的字段
  3. SQL Server中identity(自增)的用法详解
  4. Microsoft SQL Server数据库各版本下载地
  5. SqlServer生成连续数字根据指定的数字操
  6. Zabbix监控SQL Server服务状态的方法详解
  7. SQL Server 开窗函数 Over()代替游标的使
  8. SQL Server中row_number函数的常见用法示
  9. SQL Server如何通过创建临时表遍历更新数
  10. hive中将string数据转为bigint的操作