0
我已經創建了管理我的最終用戶的約會和客戶端的應用程序的基礎。我現在試圖在設備模擬器中測試應用程序,但是當模擬器打開時,我發現除了ActionBar之外,屏幕是空白的。我沒有看到我在做什麼錯,連接是活動的代碼:我的應用程序在模擬器中顯示一個白色屏幕?
package f454project.jack.chiropody;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
public class ApptsActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_appts);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_appts, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
和XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="f454project.jack.chiropody.ApptsActivity">
<TabHost android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tabHost"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:id="@+id/Appointments"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
<LinearLayout android:id="@+id/Patients"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
<LinearLayout android:id="@+id/Help"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
</FrameLayout>
</LinearLayout>
</TabHost>
<ListView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:layout_gravity="center_horizontal"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:layout_marginBottom="45dp"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Create"
android:id="@+id/button"
android:layout_alignParentStart="false"
android:layout_alignParentTop="true"
android:layout_marginTop="450dp"
android:layout_marginLeft="140dp"
android:onClick="@string/title_activity_create_appt"/>
</RelativeLayout>
由於你的listview覆蓋你的tabhost。你應該改正它們。 –
您的xml佈局存在很多問題,並且不清楚您實際上希望它看起來像什麼 –