我的闪亮应用程序中有一个框,其中有一个按钮,包含在闪亮的仪表板框中,如下所示:
shiny::fluidRow(
shinydashboard::box(title = "Intro Page", "Some description...",
shiny::actionButton(inputId='ab1', label="Learn More", icon = icon("th"))
)
)
Run Code Online (Sandbox Code Playgroud)
我想在按钮中包含一个weblink,这样当我点击它时,它应该在一个新标签中打开相应的网页.
我知道我可以这样做:
# this does not create a submit button though, it just creates a link.
tags$div(class = "submit",
tags$a(href = "www.google.com",
"Learn More",
target="_blank")
)
Run Code Online (Sandbox Code Playgroud)
但是使用actionButton,有一个很好的按钮,我可以添加一个看起来更美观的图标.
如何在有光泽的情况下添加actionButton的链接?
我知道您可以使用PendingIntents从操作按钮启动活动.如何在用户单击通知操作按钮时调用方法?
public static void createNotif(Context context){
...
drivingNotifBldr = (NotificationCompat.Builder) new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.steeringwheel)
.setContentTitle("NoTextZone")
.setContentText("Driving mode it ON!")
//Using this action button I would like to call logTest
.addAction(R.drawable.smallmanwalking, "Turn OFF driving mode", null)
.setOngoing(true);
...
}
public static void logTest(){
Log.d("Action Button", "Action Button Worked!");
}
Run Code Online (Sandbox Code Playgroud) 我是建设一个App有Rshiny.
我有几个,infoBox我想使用该href选项在点击时弹出一个infoBox.
我使用shinyBS作为弹出选项.这是我试过的:
valueBox(value=entry_01, icon = icon("users","fa-lg",lib="font-awesome"),href=shinyInput(actionLink,id='button_01',len=1,class="btn btn-default action-button",label=""),
width=NULL,color = "light-blue",subtitle = ""
)
Run Code Online (Sandbox Code Playgroud)
但我发现,href如果我们想在外部网站上链接,href = "http://stackoverflow.com/"
但我不知道如何链接应用程序的内部链接,该选项可以正常工作.
我做了这个编辑,因为我发现了一个解决方案,通过在valueBox输出列表中添加两个变量,使框可点击并使闪亮认为它是一个动作按钮.
- 类action-button
- id允许我们使用observe或observeEvent来检测单击valuebox的时间.
require(shiny)
require(shinydashboard)
header <- dashboardHeader(title="ReproductibleExample")
sidebar <- dashboardSidebar(disable=T)
body <- dashboardBody(valueBoxOutput("box_01"),
textOutput("print"))
ui <- dashboardPage(header, sidebar, body)
server<-shinyServer(function(input, output,session) {
output$box_01 <- renderValueBox({
entry_01<-20
box1<-valueBox(value=entry_01
,icon = icon("users",lib="font-awesome")
,width=NULL
,color = "blue"
,href="#"
,subtitle=HTML("<b>Test click on valueBox</b>")
)
box1$children[[1]]$attribs$class<-"action-button" …Run Code Online (Sandbox Code Playgroud) 我已经使用两个操作按钮注册了推送和本地通知:action1和action2.收到通知后,我可以看到两者,也可以根据操作ID采取措施.但是,我的一个用例要求我在安排本地通知之前隐藏一个或两个操作按钮.我可以在运行时这样做吗?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Run Code Online (Sandbox Code Playgroud)
在这个方法中,我正在注册带有2个操作按钮的通知.
我看到,根据上下文,我们可以定义可变数量的动作按钮.但是,上下文是预定义的而不是用户定义的.
objective-c push-notification ios uilocalnotification action-button
我在使用闪亮的多个动作按钮时遇到了一些麻烦.我构建了一个可以插入文本的文本区域.操纵该文本使得结果是三个字符串.然后将这三个字符串作为三个动作按钮的标签.单击其中一个按钮时,它应该操作输入文本.
当我单击动作按钮时,文本被正确操作,但动作无限重复.这是因为无法重置操作按钮.我找到了多个处理这个问题的网页,我尝试了多种解决方案和解决方法,但似乎没有任何效果.我已经提供了以下代码:
server.R
library(shiny)
library(stringi)
new_word_f <- function(x) {
x <- substr(x, nchar(x), nchar(x)) == " "
}
modify_text_input <- function(new_word, input_text, word_to_remove, answer) {
if (new_word == TRUE) {
paste(input_text, answer, " ")
} else {
paste(stri_replace_last_regex(input_text, word_to_remove, answer), " ")
}
}
start_input_text <- "Testing the lines "
ngram_input <- "lines"
answer <- c("a", "b", "c")
## Start shiny app
shinyServer(function(input, output) {
## New word or current mid-word
new_word <- reactive({new_word_f(input$text_in)})
output$input_textarea <- renderUI({tags$textarea(id="text_in", rows=3, cols=40, start_input_text)}) …Run Code Online (Sandbox Code Playgroud) 我想知道是否可以将本地pdf文件链接到Shiny中的操作按钮。例如,我有一个手动按钮。用户单击“手动”操作按钮后,将打开一个pdf文件。
提前致谢。
我正在使用 AppCompat 库中的新工具栏组件。我试图在我的工具栏上显示操作按钮,但它们从未出现。
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_login"
android:title="@string/action_login"
android:orderInCategory="100"
app:showAsAction="ifRoom" />
</menu>
Run Code Online (Sandbox Code Playgroud)
我的活动
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout,
toolbar, R.string.drawer_open, R.string.drawer_close);
toolbar.setTitle(R.string.title_activity_posts);
drawerLayout.setDrawerListener(actionBarDrawerToggle);
if (getSupportActionBar() != null)
{
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
actionBarDrawerToggle.syncState();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
有人知道如何将 actionButton (R Shiny) 重置为初始值以便多次使用它吗?
请在下面找到一个可复制的示例:
在这个例子中,我想通过选择相应的按钮来更改图表颜色:我的问题是它无法在一次迭代后重新加载图表。
library(shiny)
ui <- fluidPage(
actionButton(inputId = "button1",label = "Select red"),
actionButton(inputId = "button2",label = "Select blue"),
plotOutput("distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x))
my_color <- "green"
if (input$button1){my_color <- "red"}
if (input$button2){my_color <- "blue"}
hist(x, breaks = bins, col = my_color)
})
}
shinyApp(ui = ui, server = server)
Run Code Online (Sandbox Code Playgroud)
先感谢您
我的R Shiny应用程序中有多个选项卡,但还没有发现让操作按钮导航到另一个选项卡的方法。
第一个选项卡以“提交信息”操作按钮结尾,目标是在用户提交后打开“结果”选项卡。如果有人可能使用伪代码来实现此目的,那么任何事情都会非常有帮助。
我有多个操作按钮,我想在这些按钮上显示不同的选择输入,并且我想知道上次单击的按钮 ID,我该怎么做?当我使用
which(lapply(c(1:10), function(i) { input[[paste0("ActionButton", i)]]}) == TRUE)
Run Code Online (Sandbox Code Playgroud)
它向我显示了所有被点击的按钮,但是我想知道哪个是最后一个,以便再次点击以前的按钮。我怎样才能做到这一点?我是闪亮的新手,不确定是否了解所有反应/隔离问题,所以我会很乐意提供任何提示。
action-button ×10
r ×7
shiny ×6
android ×2
html ×1
hyperlink ×1
infobox ×1
ios ×1
javascript ×1
objective-c ×1
reset ×1
toolbar ×1