File--New--Android application Project
主类继承Activity
public class MainActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.mainactivity); } }
setContentView(R.drawable 调import com.example.activity.R;
创建layout
在AndroidManifest.xml中设置
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.lianxi.MainActivity"> //声明这个MainActivity <intent-filter > <action android:name="android.intent.action.MAIN"/> </intent-filter> </activity> </application>
时间: 2024-11-05 05:09:58