'adminlte_sidebar code example in Rstudio help not work

I copy the full code below from Rstudio help. I try to modify sidebar background using fresh package, with some property added.

if (interactive()) {
  library(shiny)
  library(shinydashboard)
  ui <- dashboardPage(
    header = dashboardHeader(title = "My dashboard"),
    sidebar = dashboardSidebar(
    ),
    body = dashboardBody(
      
      use_theme(create_theme(
        adminlte_sidebar(
          width = "400px",
          light_bg = "red",
          dark_hover_bg = "#bf431d",
          dark_color = "#d8de83"
        ),
        bs4dash_font(weight_bold = 900)
      ))
    )
  )
  server <- function(input, output, session) {
 }
  
  shinyApp(ui, server)
}

The expected output from the dashboard is the background color of the sidebar is red, but I still get the black background. The only property that affected is "width" 400px.

Below the screenshot from my pc:

When Light mode



Solution 1:[1]

Here is your answer, custom layout for dialog

https://developer.android.com/guide/topics/ui/dialogs#CustomLayout

Solution 2:[2]

If you want an editable textbox between title and list view , then you need to create custom layout. Here is full code and its working fine as shown in imagehere.

public class DialogActivity extends AppCompatActivity {


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dialog);

    String names[] ={"A","B","C","D"};
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(DialogActivity.this);
    LayoutInflater inflater = getLayoutInflater();
    View convertView = (View) inflater.inflate(R.layout.list_item, null);
    alertDialog.setView(convertView);
    alertDialog.setTitle("List");
    ListView lv = (ListView) convertView.findViewById(R.id.lv);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,names);
    lv.setAdapter(adapter);
    alertDialog.show();
}}

Here is custom list_item layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Edit Text Here"
    android:id="@+id/edit_text"/>
<ListView
    android:id="@+id/lv"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/edit_text"/>
 </RelativeLayout>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Phantom Lord
Solution 2 Mohammad Arman