我正在与Sliding Menu
合作,需要专业人士的帮助!我想用ListView
适配器添加菜单(布局)。我看到了演示应用,它是在Fragment
构建的,但是我的应用extends SlidingActivity
我无法理解如何操纵MenuView
MainActivity.class
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// MainView, MenuView
setContentView(R.layout.main);
setBehindContentView(R.layout.main_menu);
//SlidingMenu
mMainMenu = (ListView) findViewById(R.id.main_menu);
mMenuAdapter = new MenuAdapter(this, R.id.menu_adapter_title);
mMainMenu.setAdapter(mMenuAdapter);
}
答案 0 :(得分:2)
我发现只有ArrayAdapter才能解决它的问题! 如果它有帮助它是我的代码
private void populate() {
ListView lv = (ListView) findViewById(R.id.main_menu);
String[] menu = {"Главная","Кино","Театры","Вечеринки","Концерты","Выставки","Рестораны","Магазины","Фотографии","Каталог","Погода"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.main_menu_adapter, R.id.menu_adapter_title, menu);
lv.setAdapter(adapter);
}
并在setBehindContentView