我有以下主要活动,我想在我的活动中使用滑动菜单
ExampleActivity代码是:
package com.example.example;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivity;
public class ExampleActivity extends SlidingActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the content view
setContentView(R.layout.activity_example);
setBehindContentView(R.layout.sliding_menu);
// configure the SlidingMenu
getSlidingMenu().setMode(SlidingMenu.RIGHT);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
getSlidingMenu().setMenu(R.layout.sliding_menu);
}
}
我的布局文件sliding_menu.xml:
<?xml version="1.0" encoding="utf-8"?>
<com.jeremyfeinstein.slidingmenu.lib.SlidingMenu xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slidingmenumain"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
sliding:touchModeAbove="margin"
sliding:behindOffset="@dimen/0"
sliding:behindWidth="@dimen/0"
sliding:behindScrollScale="@dimen/0.25f"
sliding:fadeEnabled="true"
sliding:fadeDegree="1.0f"
sliding:selectorEnabled="true"
/>
我是全新的android我想问你是布局文件有什么不对吗?因为我收到了错误消息
未绑定的前缀
我想我应该在xmlns之后用滑动更改android但是如果我这样做仍然给我同样的错误?
答案 0 :(得分:0)
你必须在你的布局xml文件中使用它: -
xmlns:sliding="http://schemas.android.com/apk/res-auto"
有关更多信息,请查看How to use custom attributes with View