开发者

What i am doing wrong with Class Overview?

开发者 https://www.devze.com 2023-01-03 05:16 出处:网络
This code not work. Anyone can helpme? .java package rfmsoftware.util.test1; import android.app.Activity;

This code not work. Anyone can helpme?

.java

package rfmsoftware.util.test1;

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

pub开发者_运维问答lic class test1 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button button = (Button)findViewById(R.id.Button01); <---- Error at this line !?

    }
}

.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:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
<EditText android:id="@+id/EditText01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10"></EditText>
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/Scan"></Button>
<View android:id="@+id/View01" android:layout_width="wrap_content" android:layout_height="wrap_content"></View>
</LinearLayout>

.error

Button cannot be resolved to a type (type Java problem) ???


You need to import the desired Button class.


Ok.

I need: import android.widget.*;

:P

0

精彩评论

暂无评论...
验证码 换一张
取 消