This is the Java file i have for the drawer menu,there are no problems/error logs
或任何明顯錯誤的代碼看不到紙盒時刷卡左
public class DrawerActivity extends ActionBarActivity {
private DrawerLayout drawerLayout;
private ListView listView;
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.drawer_menu);
setDrawerLayout((DrawerLayout)findViewById(R.id.drawerLayout));
setListView((ListView)findViewById(R.id.drawerList));
}
public ListView getListView() {
return listView;
}
public void setListView(ListView listView) {
this.listView = listView;
}
public DrawerLayout getDrawerLayout() {
return drawerLayout;
}
public void setDrawerLayout(DrawerLayout drawerLayout) {
this.drawerLayout = drawerLayout;
}
}
我已經做了基本的XML佈局文件,它看起來像這樣
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
android:layout_height="match_parent"
android:layout_width="match_parent"
>
<FrameLayout
android:id="@+id/mainContent"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@color/dark_gray"
>
</FrameLayout>
<ListView
android:id="@+id/drawerList"
android:layout_width="240dp"
android:layout_height="match_parent"
android:entries="@array/activity_logs"
android:layout_gravity="left"
android:background="@color/dark_gray"
android:textColor="@color/gray"
>
</ListView>
</android.support.v4.widget.DrawerLayout>
我真不沒有看到任何錯誤,我已經清理了幾次這個項目並重新啓動了eclipse 幾次,還卸載並重新安裝了SDK Manager中的工具 出於想法
嘗試使用此android:layout_gravity =「開始」 – 2014-10-07 19:21:21
沒有工作,當你向左滑動時也不應該顯示抽屜嗎? – vera 2014-10-08 12:06:26