标签: menu-items

如何动态更改网页所选菜单项的颜色?

我是开发网页的新手.我希望创建类似于stackoverflow.com中的菜单(如上面显示的问题,标签,用户).如何更改所选菜单的颜色(例如,"点击"时问题的背景颜色会变为橙色)?

我设法在悬停时(使用CSS)改变颜色,因为这很简单,但我遇到了麻烦.

我是否可以仅使用CSS实现更改单击项目颜色的效果?

html css menu-items background-color menuitem-selection

19
推荐指数
2
解决办法
10万
查看次数

如何将子菜单项添加到菜单项

我已经在windows窗体中创建了一个Table布局,如图所示,我添加了一个鼠标右键单击Menu到我的表,

我想将子菜单项添加到以下菜单项中,例如

当我点击add device它应该显示子项,如sounder,MCP,strobe等当我点击fault 它应该显示子项,例如open circuit fault,sounder fault`短路故障"等

这就是我创建menuitems的方式

    ContextMenu m = new ContextMenu();
    MenuItem addDevice = new MenuItem("Add Device");
    MenuItem deleteDevice = new MenuItem("delete Device");
    MenuItem fire = new MenuItem("Fire");
    MenuItem fault = new MenuItem("Fault");
    MenuItem suppress = new MenuItem("Suppress");
    m.MenuItems.AddRange(new MenuItem[] { addDevice, deleteDevice, fire, fault,suppress});
    tableLayout.ContextMenu = m;
    m.Show((Control)(sender), e.Location);
Run Code Online (Sandbox Code Playgroud)

以下是我的表格和表格布局

http://i48.tinypic.com/33ok3cw.jpg http://i48.tinypic.com/33ok3cw.jpg

c# contextmenu menu-items tablelayout winforms

9
推荐指数
1
解决办法
4万
查看次数

如何将项目添加到文本选择弹出菜单?

当用户标记一些文本(在EditText, WebView... 内)时,会出现一个浮动文本选择弹出窗口,应用程序可以在其中添加自定义项目。有人可以给我一个例子,如何将一个项目添加到这个弹出菜单中,这使得一个意图并将所选内容转移String到我的活动中。

在此处输入图片说明

java android menu-items android-intent

9
推荐指数
1
解决办法
4600
查看次数

如何在BottomNavigationView中显示没有色调的菜单项图标

我创建了一个BottomNavigationView包含三个项目。其中之一是用户选项卡

底部

对于访客选项卡,有一个图像,但 TintColor 正在应用,我们看不到它。

那么如何去除特定项目的色调?

我试过了

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                            item.setIconTintList(null);

                        }
Run Code Online (Sandbox Code Playgroud)

但没有运气。它适用于 api 26 以上

我的活动

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottomNavigationView"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    app:itemIconTint="@drawable/bottom_color_state"
    app:itemBackground="@color/colorAccent"
    app:itemTextColor="@drawable/bottom_color_state"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:menu="@menu/menu_bottom_navigation" />
Run Code Online (Sandbox Code Playgroud)

底部颜色状态.xml

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item android:color="@color/white" android:state_enabled="true" />
        <item android:color="@color/colorPrimaryDark" android:state_enabled="false" />
        <item android:color="@color/white" android:state_selected="true" />
        <item android:color="@color/off_white" android:state_selected="false" />
        <item android:color="@color/white" android:state_checked="true" />
        <item android:color="@color/off_white" android:state_checked="false" />
        <item android:color="@color/off_white" />
    </selector>
Run Code Online (Sandbox Code Playgroud)

提前致谢

android menu menu-items bottomnavigationview

8
推荐指数
3
解决办法
5166
查看次数

Material-ui:按事件悬停打开菜单

当前,menuItem仅在单击后打开您的孩子。是否有我同意通过悬停打开的属性?

<MenuItem key={index}
  menuItems={menuitems}
  **onHover={true}**
>
 menuItem
</MenuItem>
Run Code Online (Sandbox Code Playgroud)

menu-items reactjs material-ui

5
推荐指数
1
解决办法
6406
查看次数

是否可以通过单击 Electron 类型复选框的 MenuItem 来不关闭当前子菜单?

我的 Electron 应用程序中有一个子菜单,其中有几个“复选框”类型的菜单项:

{
        label: 'Search settings',
        submenu: [
          {
            type: 'checkbox',
            checked: false,
            label: 'Aerodromes',
            click: (/* menuItem, currentWindow, event */) => {
              console.log('')
              console.log('menuItem Aerodromes is clicked')
              // TODO: change userPrefs about search sources
            }
          },
          {
            type: 'checkbox',
            checked: false,
            label: 'Heliports and HL',
            click: (/* event, focusedWindow, focusedWebContents */) => {
              console.log('')
              console.log('menuItem Heliports and HL is clicked')
              // TODO: change userPrefs about search sources
            }
          },
          {
            type: 'checkbox',
            checked: false,
            label: 'LP',
            click: (/* …
Run Code Online (Sandbox Code Playgroud)

javascript menu-items electron

5
推荐指数
0
解决办法
584
查看次数

展开时CollapsingToolbarLayout底部的菜单项

我一直在搜索一段时间,如下图所示,但不幸的是我找不到类似的东西

edit menu item正在向底部的CollapsingToolbarLayout,当它被展开

在此处输入图片说明在此处输入图片说明在此处输入图片说明在此处输入图片说明

我为菜单项尝试了多种属性组合,但没有成功

这是我的尝试

在此处输入图片说明

我的屏幕XML

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".ui.activities.AmbassadorActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:toolbarId="@+id/toolbar">

            <ImageView
                android:id="@+id/photo"
                android:scaleType="centerCrop"
                android:transitionName="@string/ambassador_photo"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax"
                android:contentDescription="@string/ambassador_photo" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:navigationIcon="@drawable/ic_arrow_back_white_24dp"
                app:popupTheme="@style/AppTheme.PopupOverlay" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_ambassador" />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

我的菜单XML

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".ui.activities.AmbassadorActivity">
    <item
        android:id="@+id/action_save"
        android:title="@string/save"
        android:icon="@drawable/ic_save_white_24dp"
        android:orderInCategory="300"
        app:showAsAction="always" />

    <item android:id="@+id/action_skills"
        android:title="@string/skills"
        app:showAsAction="ifRoom"
        android:orderInCategory="200"
        android:icon="@drawable/ic_local_activity_white_24dp"/>

    <item …
Run Code Online (Sandbox Code Playgroud)

android menu menu-items android-layout android-collapsingtoolbarlayout

4
推荐指数
2
解决办法
1484
查看次数

根据ViewPager Android显示菜单项

我的Android应用中有一个带有片段的ViewPager.我想根据ViewPager的片段显示Action Bar菜单项.我已经对此提出了一些问题,但我找不到正确的解决方案.我的ViewPager代码是这样的:

    public class My_Activity extends ActionBarActivity  {

        private ViewPager mViewPager;
        String idioma;


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


            ActionBar actionBar = getSupportActionBar(); // || getActionBar();
            actionBar.setIcon(getResources().getDrawable(R.drawable.navbar_logo));
            actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#CC3333")));

            actionBar.setTitle("Hello");



             mViewPager = (ViewPager) findViewById(R.id.viewpager);
             PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pagerTabStrip);
             pagerTabStrip.setTabIndicatorColor(getResources().getColor(R.color.blanco));


             Title_Liga_Adapter titleAdapter = new Title_Liga_Adapter(getSupportFragmentManager());
             mViewPager.setAdapter(titleAdapter);

             mViewPager.setCurrentItem(0);

             getSupportActionBar().setIcon(R.drawable.navbar_logo);

             getSupportActionBar().setDisplayHomeAsUpEnabled(true);


            }


     @Override
public boolean onCreateOptionsMenu(Menu menu) {
if (mViewPager.getCurrentItem()==4){
    getMenuInflater().inflate(R.menu.menu_comunidad, menu);
}
else{

}
      return true;  
}


/* *
 * Called when invalidateOptionsMenu() is triggered
 */
@Override
public boolean …
Run Code Online (Sandbox Code Playgroud)

android menu-items android-viewpager android-actionbar

3
推荐指数
1
解决办法
4511
查看次数

在 tabItems 闪亮仪表板之间切换

我正在创建一个闪亮的仪表板,我创建了 3 个 tabItems 问题是,当我单击其中一个 menuItem 时,我无法再次单击,我无法在 tabItems 之间切换。有人可以帮我请代码 R #UI

 library(shiny)
 library(shinydashboard)

 shinyUI(dashboardPage(skin = "black",
 dashboardHeader(title = h4("Tableau de bord des élections",style =      "color:navy"),
 titleWidth = 300
 ),
 dashboardSidebar(id="", 
 menuItem(h4(strong("Dashboard", align = "center")), tabName = "dashboard"),
 menuItem(h4(strong("Prédiction")), tabName = "Prédiction"),
 menuItem(h4(strong("Interprétation")), tabName = "Interprétation")),



 dashboardBody(
    tabItems(
        tabItem(tabName = "dashboard",h2("Analyse du comportement électoral  des citoyens tunisiens", align="center",style = "color:navy") ),

        tabItem(tabName = "Prédiction", h2("Prédiction du vote",    align="center",style = "color:blue")),
        tabItem(tabName = "Interprétation", h2("Interprétation"))

        )
        )))
Run Code Online (Sandbox Code Playgroud)

r menu-items tabitem shinydashboard

3
推荐指数
1
解决办法
5081
查看次数

如何以编程方式更改选定的导航项目

当我创建一个新项目时,我使用了Navigation Drawer Activity 应用程序屏幕

现在,当我单击每个菜单项时,它会通过调用方法名称替换来打开一个片段。

    public boolean onNavigationItemSelected(MenuItem item) {
            // Handle navigation view item clicks here.
            int id = item.getItemId();

            if (id == R.id.nav_home) {
                replaceFragment(0);
                setTit = "Your State Info.";
                setTitle(setTit);
 } else if (id == R.id.nav_flashcards) {

            replaceFragment(1);
            setTit = "Flash Cards";
            setTitle(setTit);
Run Code Online (Sandbox Code Playgroud)

在片段1中,当检查的更改打开碎片时,我有一个射线组取决于所检查的无线电。

 @Override
    public void onCheckedChanged(RadioGroup radioGroup, int i) {

        RadioButton radioButton = (RadioButton)getActivity().findViewById(i);

            if(radioButton.getTag()==1)
        ((MainActivity) getActivity()).replaceFragment(0);
           else if ((radioButton.getTag()==2))
             ((MainActivity) getActivity()).replaceFragment(2);
    }
Run Code Online (Sandbox Code Playgroud)

该应用程序工作正常,但问题是如何更改选定的导航项并更改操作栏的标题。

可以使用这种方式

 ((MainActivity) getActivity()).onNavigationItemSelected(menuitem);
Run Code Online (Sandbox Code Playgroud)

但是从片段中,我如何访问menu>activity_main_drawer.xml 中的项目并通过 menuitem 传递它

android menu-items

3
推荐指数
1
解决办法
6789
查看次数

MenuItems 问题中的闪亮仪表板输入

我是闪亮仪表板的新手,我正在尝试制作一个简单的仪表板。我正在尝试组合一个仪表板,该仪表板将基本上通过不同的聚类算法并展示它们是如何工作的。

我有一个用于整个分支主题的菜单项,然后在这些菜单中输入指定聚类算法参数的项目。

我的问题是我无法在屏幕上获得任何输出。我什至无法渲染我放置在 tabItems 中的框的标题的图。当我在我的菜单项之一中放置一个子项时,似乎会发生这种情况。我不知道为什么。

附件是我的 ui.R 脚本和 server.R 脚本。

ui.R 文件: ui.R文件

server.R 文件:

server.R 文件

对此事的任何帮助将不胜感激。

menu-items shinydashboard

3
推荐指数
1
解决办法
2262
查看次数

减少导航抽屉菜单项的左边距?

我在导航抽屉中使用了自定义菜单。我只想减少菜单项的左边距,然后将图像视图稍微靠近边距(向左)。我已经更改了尺寸,以减小底部边距并移动图像视图和文本视图。

<!-- Override the private variables in navigation drawer-->
    <dimen name="design_navigation_icon_size">45dp</dimen>
    <dimen name="design_navigation_icon_padding">5dp</dimen>
    <dimen name="design_navigation_separator_vertical_padding">0dp</dimen>
    <dimen name="design_navigation_seperator_left_margin">0dp</dimen>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

我只想减少图像的16dp空间。是否有任何尺寸变量可以覆盖以执行此操作?

NavigatonView:

<android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:itemIconTint="@null"
        app:menu="@menu/activity_main_drawer"
        app:itemTextAppearance="@style/NavigationDrawerStyle">
Run Code Online (Sandbox Code Playgroud)

我已经添加了

tools:override="true"
Run Code Online (Sandbox Code Playgroud)

在DrawerLayout中。

menu_drawer看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <group android:id="@+id/grp1" android:checkableBehavior="single">
        <item
            android:id="@+id/navigation_item_1"
            android:icon="@drawable/menu_home_unselected"
            android:title="Home" />
    </group>

    <group android:id="@+id/grp2" android:checkableBehavior="single" >
        <item
            android:id="@+id/navigation_item_2"
            android:icon="@drawable/menu_identify"
            android:title="Identity" />
    </group>

    <group android:id="@+id/grp3" android:checkableBehavior="single" >
        <item
            android:id="@+id/navigation_item_3"
            android:icon="@drawable/menu_self_disclosure"
            android:title="Disclosure" />
    </group>
</menu>
Run Code Online (Sandbox Code Playgroud)

android menu-items navigation-drawer material-design

2
推荐指数
1
解决办法
4625
查看次数

角材料:垫菜单中的复选框;黑暗主题的问题

你不能把一个<mat-checkbox><mat-menu>正常进行。如果是这样,黑暗的主题并不适用于文本部分的你<mat-checkbox> (请参照最后的图像)

关于<mat-label>s存在类似的问题。但是解决方案很简单:

  • 使用 <label mat-menu-item> 代替 <mat-label>

关于buttons 同样。


但是我找不到适用于<mat-checkbox>es 的类似解决方案!这些都是我测试过的状态:

<mat-menu #menu="matMenu">
  <mat-label>Bad label</mat-label>
  <label mat-menu-item>OK label</label>
  <mat-checkbox>Problem here</mat-checkbox>
  <!-- ERROR:
  <mat-checkbox  mat-menu-item>
    Template parse errors:
More than one component matched on this element.
  </mat-checkbox>
  -->
  <br><mat-checkbox></mat-checkbox>
  <label mat-menu-item style="display:inline">Not good workaround</label>
</mat-menu>
Run Code Online (Sandbox Code Playgroud)

这里的闪电战

结果:

在此处输入图片说明

checkbox menu menu-items angular-material angular

2
推荐指数
2
解决办法
1607
查看次数