1
我正在通過使用最新SDK的上的MyFirstApp教程。Android元素不顯示
我創建了一個4.1應用程序,並設置了我的仿真器,其LCD密度爲213,VM應用程序堆爲48,設備RAM大小爲512.分辨率爲720x1280。
當我第一次得到這個時,我的「Android」在模擬器上閃現。
我注意到,我的佈局main.xml中沒有被默認創建的,所以我在res /佈局添加它自己
添加以下的main.xml和strings.xml中
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<EditText android:id="@+id/edit_message"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_width="0dp"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send" />
</LinearLayout>
<resources>
<string name="app_name">My First App</string>
<string name="edit_message">Enter a message</string>
<string name="button_send">Send</string>
</resources>
現在當我運行我的模擬器時,我只是得到一個黑屏。我的猜測是,我沒有正確添加main.xml或者我的xml文件中有錯誤。
你做的setContentView(R.layout.main)方法( )你的活動的方法? – 2012-07-14 11:22:50
iam試着讓你的代碼完美工作.. – NagarjunaReddy 2012-07-14 11:36:48
@SiddharthLele你對活動的評論指出我的方向是正確的,我沒有在啓動向導中正確設置它。如果您發佈答案,我會接受它。 – Liath 2012-07-14 11:48:23