对于以下代码段,IDEA会发出警告,这future {None}将是多余的:
queryString match {
case Some(query) => ... // Do async call
case None => future { None }
}
Run Code Online (Sandbox Code Playgroud)
有更好的可能吗?
我在我的应用程序中更改了ActionBar的背景颜色,并且工作正常.但后来我想在我的活动中改变我的背景颜色,现在看起来非常糟糕.
这是我的主题xml:
<style name="TucanActionBarStyle" parent="Widget.Sherlock.Light.ActionBar">
<item name="android:background">@color/actionbar_green</item>
</style>
<style name="Theme.TucanActionBar" parent="@style/Theme.Sherlock.Light">
<item name="android:actionBarStyle">@style/TucanActionBarStyle</item>
<item name="android:background">@android:color/white</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这就是它的外观:http: //dl.dropbox.com/u/2683101/Screenshot_2012-05-18-19-49-23.png
我有一个使用ActionBarSherlock的Activity.现在我想在该操作栏中显示一个Indeterminate Progress,并按照ActionBarSherlock中的示例进行操作:
public class MainMenu extends SimpleWebActivity implements BackgroundBrowserReciever {
private Boolean windowFeatureCalled;
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
this.windowFeatureCalled = true;
setContentView(R.layout.main_menu);
....
}
Run Code Online (Sandbox Code Playgroud)
SimpleWebActivity是一个扩展SherlockActivity的抽象类.
但是当我尝试加载该Activity时,我收到以下错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dalthed.tucan/com.dalthed.tucan.ui.MainMenu}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
Run Code Online (Sandbox Code Playgroud)
为什么会出现这种错误,即使我在调用setContentView之前请求WindowFeature?