问题描述
我希望我的导航抽屉在按下其中的按钮时关闭,但它没有关闭。我试过 drawerLayout.closeDrawer(GravityCompat.START) 和 drawerLayout.closeDrawers();但这些在这方面似乎不起作用。
我的 MainActivity.java
library(shiny)
library(ggplot2)
library(dplyr)
shinyServer(function(input,output) {
output$ufoPlot <- renderPlot({
ufo_data_filter <- filter(ufo_data,Country == input$Country)
ggplot(data = ufo_data_filter) +
geom_bar(mapping = aes(x = Shape))+
labs(
title = "Number of Different Shaped UFO Observations",x = "Shape of UFO Sighted",y = "Number of Observations in 2016"
)
})
})
这是我的 activity_main.xml 我的组件顺序不正确吗?在这方面重要吗?
@SuppressLint("NonConstantResourceId")
@Override
public boolean onNavigationItemSelected(@NonNull @NotNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_share:
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBodyText = "Check out this awesome store at https://google.com";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Check out our store");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,shareBodyText);
startActivity(Intent.createChooser(sharingIntent,"Sharing Option"));
return true;
}
drawerLayout.closeDrawer(GravityCompat.START);
return true;
}
private void setNavigationViewListener() {
NavigationView navigationView = findViewById(R.id.nv);
navigationView.setNavigationItemSelectedListener(this);
}
@SuppressLint({"SetJavaScriptEnabled","NonConstantResourceId"})
@Override
public boolean onoptionsItemSelected(MenuItem item) {
if (actionBarDrawerToggle.onoptionsItemSelected(item)) {
return true;
}
return super.onoptionsItemSelected(item);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)