小编AG1*_*AG1的帖子

iOS 8中的NavigationBar栏,色调和标题文本颜色

状态栏中的背景文本仍为黑色.如何将颜色更改为白色?

// io8, swift, Xcode 6.0.1 
override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.navigationBar.barTintColor = UIColor.blackColor()
    self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.orangeColor()]

}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

uinavigationbar ios swift ios8

167
推荐指数
10
解决办法
21万
查看次数

ActionBarCompat:java.lang.IllegalStateException:您需要使用Theme.AppCompat

我得到在Android 2.3.5一个RuntimeException,但我正在用Theme.AppCompat(RES /价值/的themes.xml).这是电话:http://www.gsmarena.com/samsung_galaxy_y_s5360-4117.php

 <!-- res/values/themes.xml -->
 <?xml version="1.0" encoding="utf-8"?>
 <resources>

     <style name="Theme.Styled" parent="@style/Theme.AppCompat">
         <item name="actionBarStyle">@style/QueryActionBar</item>
         <item name="android:actionBarStyle">@style/QueryActionBar</item>
     </style>

     <style name="QueryActionBar" parent="@style/Widget.AppCompat.ActionBar">
         <item name="background">@color/blueback</item>
         <item name="android:background">@color/blueback</item>
         <item name="backgroundSplit">@color/blueback</item>
         <item name="android:backgroundSplit">@color/blueback</item>
     </style>

 </resources>
Run Code Online (Sandbox Code Playgroud)

这是values-v11的文件.

 <!-- res/values-v11/themes.xml -->
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
    <style name="QueryTheme" parent="@android:style/Theme.Holo">
    <!-- Any customizations for your app running on devices with Theme.Holo here -->
    </style>
 </resources>
Run Code Online (Sandbox Code Playgroud)

这是错误.

 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.txt2lrn.www/com.txt2lrn.www.LandingActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with …
Run Code Online (Sandbox Code Playgroud)

android runtimeexception android-actionbar

102
推荐指数
6
解决办法
16万
查看次数

RxJava和Retrofit2:NetworkOnMainThreadException

我意识到我在MainThread上使用了subscribeOn()/ observeOn().我可以传递给subscribeOn()的选项有哪些?我可以传递给observeOn()的选项有哪些?

12-17 21:36:09.154 20550-20550/rx.test D/MainActivity2: [onCreate]
12-17 21:36:09.231 20550-20550/rx.test D/MainActivity2: starting up observable...
12-17 21:36:09.256 20550-20550/rx.test D/MainActivity2: [onError] 
12-17 21:36:09.256 20550-20550/rx.test W/System.err: android.os.NetworkOnMainThreadException
Run Code Online (Sandbox Code Playgroud)

GovService.java

import java.util.List;
import retrofit.Call;
import retrofit.http.GET;
import rx.Observable;

public interface GovService {
    @GET("/txt2lrn/sat/index_1.json")
    Observable<MyTest> getOneTestRx();
}
Run Code Online (Sandbox Code Playgroud)

MyTest.java

public class MyTest {
    private String name, url;
    private int num;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) …
Run Code Online (Sandbox Code Playgroud)

android rx-java retrofit

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

Google +登录:活动无法启动

我在我的项目中使用com.actionbarsherlock.app.SherlockActivity.当我尝试启动另一项活动,我需要在其中进行Google+登录时会发生此错误.我在实际设备上收到此错误,而不是模拟器.你觉得我做错了什么?

错误

05-12 15:58:12.487: E/AndroidRuntime(24310): FATAL EXCEPTION: main
05-12 15:58:12.487: E/AndroidRuntime(24310): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gms/com.google.android.gms.plus.activity.AccountSignUpActivity}: java.lang.SecurityException: Must be started via startActivityForResult
05-12 15:58:12.487: E/AndroidRuntime(24310):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at android.os.Looper.loop(Looper.java:137)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at android.app.ActivityThread.main(ActivityThread.java:5041)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at java.lang.reflect.Method.invokeNative(Native Method)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at java.lang.reflect.Method.invoke(Method.java:511)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-12 15:58:12.487: E/AndroidRuntime(24310):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-12 …
Run Code Online (Sandbox Code Playgroud)

android google-plus android-activity actionbarsherlock

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

八度:找到一行中的最小值,也是它的索引

如何找到每行中的最小值,以及最小值的索引?

octave:1> a = [1 2 3; 9 8 7; 5 4 6]
a =

   1   2   3
   9   8   7
   5   4   6
Run Code Online (Sandbox Code Playgroud)

find min octave indices

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

quantmod :: chart_Series和mapply给出图表参数错误

如何在chart_Series中正确使用MoreArgs?

p.txt

s,n
ABBV,AbbVie
BMY,Bristol
LLY,EliLily
MRK,Merck
PFE,Pfizer
Run Code Online (Sandbox Code Playgroud)

苏菲

# R --silent --vanilla < sof.r
library(quantmod)
options("getSymbols.warning4.0"=FALSE)
options("getSymbols.yahoo.warning"=FALSE)

# setup chart params
cp <- chart_pars()
cp$cex=0.55
cp$mar=c(1,1,0,0) # B,L,T,R
# setup chart theme
ct <- chart_theme() 
ct$format.labels <- ' ' # AG: space needed to remove bottom x-axis labels
ct$lylab <- TRUE        # AG: enable left y-axis labels
ct$rylab <- FALSE       # AG: remove right y-axis labels
ct$grid.ticks.lwd=1

# read values into vectors
csv <- read.csv("p.txt", stringsAsFactors = …
Run Code Online (Sandbox Code Playgroud)

r candlestick-chart quantmod mapply

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

为什么android:listSelector错误地从Activity更改为Activity

重现的步骤 - 这发生在Android 4.2.2上 - 我没有看到它发生在Android 4.2.1上

  1. 回答几个问题,退出应用程序
  2. 回到应用程序
  3. 选择一个问题集 - 它是holo_LIGHT_blue
  4. 转到另一个活动(例如信息屏幕)并返回
  5. 选择一个问题集 - 它是holo_DARK_blue
  6. 注意:我不是在修改android:list_selector,我使用默认的Android.

你认为系统正在缓存某些东西吗?

    <ListView
    android:id="@+id/landing_lv"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:cacheColorHint="@android:color/transparent"
    android:divider="@color/white_alpha"
    android:dividerHeight="1dip"
    android:scrollingCache="false"
    android:animationCache="false"
    android:drawSelectorOnTop="false"
    android:padding="0dip" />
Run Code Online (Sandbox Code Playgroud)

这是应用程序的URL,如果你想尝试一下,但我认为这个问题可以在不下载的情况下得到解答.https://play.google.com/store/apps/details?id=com.txt2lrn.www

之前 - 浅蓝色 之后 - 深蓝色

android listview selector

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

sqlite3.OperationalError:无法解码为UTF-8列

我有一个带有这一行信息的sqlite数据库,ù应该是' - '

sqlite> select * from t_question where rowid=193;
193|SAT1000|having a pointed, sharp qualityùoften used to describe smells|pungent|lethargic|enigmatic|resolute|grievous
Run Code Online (Sandbox Code Playgroud)

当我从python中读取该行时,我得到了这个错误,我做错了什么?

Traceback (most recent call last):
  File "foo_error.py", line 8, in <module>
    cur.execute(sql_string)
  sqlite3.OperationalError: Could not decode to UTF-8 column 'posit' with text 'having a pointed, sharp qualityùoften used to describe smells'
Run Code Online (Sandbox Code Playgroud)

Python文件:

import sqlite3
conn = sqlite3.connect('sat1000.db')
cur = conn.cursor()
sql_string = 'SELECT * FROM t_question WHERE rowid=193'
cur.execute(sql_string)
conn.close()
Run Code Online (Sandbox Code Playgroud)

python sqlite

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

clang ++:原子不编译

// http://en.cppreference.com/w/cpp/atomic/atomic/is_lock_free

#include <iostream>
#include <utility>
#include <atomic>

struct A { int a[100]; };
struct B { int x, y; };
int main()
{
    std::cout << std::boolalpha
              << "std::atomic<A> is lock free? "
              << std::atomic<A>{}.is_lock_free() << '\n'
              << "std::atomic<B> is lock free? "
              << std::atomic<B>{}.is_lock_free() << '\n';
}
Run Code Online (Sandbox Code Playgroud)

需要添加什么神奇的编译器或链接器标志来解决此问题?

$ clang++ --version
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

$ clang++ -o atomic atomic.cpp -std=c++14 -O2 -Wall -pedantic -lpthread
Undefined symbols for architecture x86_64:
  "___atomic_is_lock_free", …
Run Code Online (Sandbox Code Playgroud)

c++ atomic

6
推荐指数
0
解决办法
1334
查看次数

如何扩展行?

我正在尝试使用GridLayout,并且无法扩展行(使用TextViews)来"填充"布局中的空间.

垂直图片(注意红线是行应该展开的位置): 在此输入图像描述

水平图片:
在此输入图像描述

main.xml中:

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:columnCount="2"
  android:useDefaultMargins="true" >
<TextView
    style="@android:style/TextAppearance.Large"
    android:layout_columnSpan="2"
    android:layout_gravity="center_horizontal"
    android:padding="8dp"
    android:text="Which means: lacking in originality as to be obvious and boring." />
<Space android:layout_height="24dp" android:layout_columnSpan="2" />
<TextView style="@style/AnswerLetter" android:text="A." />
<TextView style="@style/AnswerChoice" android:text="ascetic" />
<TextView style="@style/AnswerLetter" android:text="B." />
<TextView style="@style/AnswerChoice" android:text="banal" />
<TextView style="@style/AnswerLetter" android:text="C." />
<TextView style="@style/AnswerChoice" android:text="contraption" />
<TextView style="@style/AnswerLetter" android:text="D." />
<TextView style="@style/AnswerChoice" android:text="dominion" />
<TextView style="@style/AnswerLetter" android:text="E." />
<TextView style="@style/AnswerChoice" android:text="enervation" />
</GridLayout>
Run Code Online (Sandbox Code Playgroud)

styles.xml:

 <style name="AnswerLetter" parent="@android:style/TextAppearance.Medium"> …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-gridlayout

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