我的button无法显示,无报错,也对比过成功的例子,实在找不到原因

ccsosnfs ccsosnfs 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
运行无任何报错,也对比了成功的例子。
真奇怪


activity1.java
package cc.activity;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

public class activity1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//选择主视图使用的布局

TextView textview1 = (TextView) this.findViewById(R.id.textview1);
textview1.setText("textview1");

Button button1 = (Button) this.findViewById(R.id.button1);
//根据ID调用
button1.setText("button1");
button1.setBackgroundColor(Color.GREEN);


}

}


mail.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/stringAct1"
/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

/>

</LinearLayout>


AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.activity"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="3"/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".activity1"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>


</manifest>
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
ccsosnfs
Android 80,490 成员 91,371 内容