问题列表 - 第45791页

为什么模拟器中的菜单按钮显示我的应用程序的所有活动?

我只是希望它在主菜单上只显示一个活动并隐藏其余活动.

我的清单文件看起来像这样.

<application android:icon="@drawable/icon" android:label="@string/app_name"
    android:debuggable="true">
    <activity android:name=".MainAct" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".StartGame" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Instructions" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".About" android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
Run Code Online (Sandbox Code Playgroud)

android menu emulation android-activity

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

可变高度滚动div,相对于可变高度的兄弟定位

最近我问了这个问题:溢出(滚动) - 100%容器高度关于如何实现具有可变高度的垂直滚动div.

一个非常有用的用户提供了一个使用绝对定位和高度的解决方案:100%,这里:http://jsfiddle.net/TUwej/2/.在这个小提琴中,您可以看到基本的所需行为 - 滚动div将填充主容器的高度,这由'#main'元素中的内容决定.

我有点修改并使用top:0 bottom:0而不是height:100%以容纳可滚动区域上方的元素.修改后的版本可以在这里看到:http://jsfiddle.net/N6muv/3/(我意识到有一些额外的标记和类定义是空的,并且相邻的兄弟组合似乎是多余的 - 这些是实际结构)

一切都很好,除了我必须为滚动div提供一个固定的顶部坐标(注意顶部:'.sidebar-list'选择器的120px声明).我想这是相对于它上面的'.sidebar-options'元素,所以上面的选项容器可以有任意数量的选项,可滚动的div将适当地定位自己.使用固定坐标,如果添加或删除任何选项,则会发生重叠或产生不必要的空间 - 我想避免这种情况.应该出现的确切选项数量因视图而异.

我曾想过将滚动div包装在一个相对定位的容器中,但这样做会产生与bottom的冲突:0不再指示主'.wrapper'容器的高度(应该这样做).类似地,使用height:100%将使用'.wrapper'容器的计算高度,因此可滚动div将超出'.wrapper'的边界.

有没有办法保持第二个小提琴中显示的功能,但可滚动div的顶部相对于选项div的底部(可变高度)?

在此先感谢您的任何建议.

编辑:SO问我是否想要开始赏金,所以我做了(第一次) - 希望100分不算太低.仍然在寻找一个无脚本的纯css解决方案,它不涉及y轴的固定坐标或尺寸(宽度和左侧分配都可以).谢谢

css

7
推荐指数
1
解决办法
6427
查看次数

Rails 3如果路径匹配root:to path,则应用CSS类

我是ROR的新手,我喜欢它,因为我开发了我的第一个应用程序.当我将格式应用于导航菜单时,我有一个与我的应用程序模板相关的问题.

是否可以检查url路径是否与root:to config.rb中设置的路径匹配?我有一个辅助方法,它返回字符串"current",它添加了css类样式以突出显示所选的菜单项.只要我不在主页,帮助方法就可以正常工作.当我的网址是www.localhost:3000/css当前类没有应用于Products链接,因为request_uri ="/"不等于"/ products".当我在主页上时,我希望将css类"current"应用于Products菜单项.

是否有任何条件逻辑可用于获取根:路径并检查它是否与is_current的参数路径匹配?

这是我的代码:

routes.rb root:设置为指向产品索引视图

root:to =>'products #index'

application.html.erb

  • <%= link_to'Products',products_path,:class => is_current(products_path)%>
  • <%= link_to'Reports',reports_path,:class => is_current(reports_path)%>
  • application_helper.rb

    def is_current(path)
        if request.request_uri == path
            return 'current'
        end
    end
    
    Run Code Online (Sandbox Code Playgroud)

    任何帮助将不胜感激.

    谢谢,bkasen

    navigation menu selecteditem helper ruby-on-rails-3

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

    TypedFactoryFacility:传递null参数

    考虑以下测试:

        [Test]
        public void Create_ServiceWithDynamicDependency_Created()
        {
            // arrange
            IWindsorContainer container = new WindsorContainer();
    
            container.AddFacility<TypedFactoryFacility>();
    
            container.Register(Component.For<IServiceFactory>().AsFactory());
    
            container.Register(Component.For<ServiceWithDynamicDependency>().LifeStyle.Transient);
            container.Register(Component.For<SomethingStatic>().LifeStyle.Transient);
    
            var factory = container.Resolve<IServiceFactory>();
    
            // act
            ServiceWithDynamicDependency serviceWithDynamicDependency = factory.Create(null);
    
            // assert
            Assert.That(serviceWithDynamicDependency, Is.Not.Null);
        }
    
    Run Code Online (Sandbox Code Playgroud)

    此操作失败,出现以下异常:无法解析'Testing.Windsor.Factory.ServiceWithDynamicDependency'(Testing.Windsor.Factory.ServiceWithDynamicDependency)的非可选依赖项.参数'somethingDynamic'类型'System.String'

    如果我用这个替换断言部分:

            ServiceWithDynamicDependency serviceWithDynamicDependency = factory.Create("foo");
    
    Run Code Online (Sandbox Code Playgroud)

    组件按预期解析.有没有人知道这个的解决方法,还是我必须手工处理接受空参数的工厂?

    castle-windsor

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

    我是否在我的cpp文件或包含的头文件中放入#include指令是否重要?

    我的c ++程序使用一个单独的头文件(让我们称之为myHeader.h),因此包含它(#include "myHeader.h").在我的程序中,我需要使用另一个头文件(让我们称之为another.h).将#include "another.h"指令放在cpp文件中还是放在myHeader.h?中会有所不同吗?

    c++ include

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

    Cocoa - NSWindow动画何时展出?

    在显示简单的nswindow时,如何添加某种CoreAnimation效果?

    谢谢

    xcode cocoa objective-c nswindow

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

    查找形状边界上的点坐标

    假设我有这样的形状:

    在此输入图像描述

    在我想要画豆子的所有笑话都筋疲力尽之后,我想找到形状边界上的点.我知道可以有很多,所以它们之间的距离是可以接受的.

    是否有针对这种需求的算法?还是一个软件?我提出的所有解决方案都涉及大量的手工工作,特别是如果我想绘制略微不同的形状.

    Stackoverflow智慧,请帮忙.

    language-agnostic algorithm image shapes

    6
    推荐指数
    1
    解决办法
    1667
    查看次数

    让SASS与Rails一起使用3

    我试图让SASS与Rails 3一起工作.我已经添加gem 'haml'到我的Gemfile(并运行bundle install)并且我已经添加了一个styles.scss到我的public/目录,但它似乎没有工作.有人可以帮我吗?谢谢!

    sass ruby-on-rails-3

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

    异步/等待取消机制

    我有一个问题,可以使用什么机制取消正在进行的异步操作,而不是async/await上下文中的取消令牌.我确信这是一个经过充分研究的设计决策,考虑到语言的命令性,但在实际情况下,必须将取消对象传递给所有异步方法至少有点痛苦.还有来自c#社区的另一个设计思路,或者建议的取消机制是否正常?我想我错过了什么.

    c# async-await

    6
    推荐指数
    1
    解决办法
    4858
    查看次数

    如何在C#中声明一个常量Guid?

    是否有可能在C#中声明一个恒定的Guid?

    我明白我可以声明一个static readonly Guid,但是有一种语法允许我写const Guid吗?

    c# guid const constants compile-time-constant

    51
    推荐指数
    5
    解决办法
    4万
    查看次数