小编Joe*_*ean的帖子

如何在Android Studio中重新启用设计调色板

我最近改用Android Studio作为Android开发的默认IDE.在设计我的UI时,我通常使用设计视图中的调色板来帮助在预览屏幕上排列小部件.最近发生了一些奇怪的事情,它刚刚消失,我似乎无法重新启用它.通常情况下,我会看到侧面的小调色板按钮,但现在它已经消失了.当我打开另一个项目时,我看到调色板但没有显示我正在处理的当前项目.

在此输入图像描述

当我在Android Studio中打开另一个项目时,我会看到调色板选项卡.

在此输入图像描述

palette android-studio

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

Phil Sturgeon的Codeigniter Restserver和Backbone.js中的HTTP OPTIONS错误

backbone.js当我尝试将模型保存到位于另一个主机/ URL上的restful Web服务时,我的应用程序抛出了HTTP OPTIONS not found错误.

根据我的研究,我从这篇文章中收集到:

请求将不断发送OPTIONS http请求标头,并且根本不会触发POST请求.

显然CORS的请求将"对用户数据产生副作用"将使您的浏览器"预检"带有OPTIONS请求标头的请求以检查批准,然后再实际发送您的预期HTTP请求方法.

我试图绕过这个:

  • 将Backbone中的emulateHTTP设置为true.

Backbone.emulateHTTP = true;

  • 我还允许在标题中允许所有CORS和CSRF选项.

    header('Access-Control-Allow-Origin:*');
    header("Access-Control-Allow-Headers:Origin,X-Requested-With,Content-Type,Accept"); header("Access-Control-Allow-Methods:GET,POST,OPTIONS");

Backbone.emulateHTTP引入代码行时,应用程序崩溃了.

有没有办法在CodeIgniter RESTServer中响应OPTIONS请求,是否还有其他选择允许从谈话地点禁用此请求?


在Github上找到了这个解决方案.我不确定我是否应该使用它,因为它看起来有点过时了.

rest codeigniter backbone.js http-options-method codeigniter-restserver

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

设置android-support-v7-appcompat之后缺少R.java

我正在尝试更改我的Eclipse项目,使其向后兼容Android 2.1.我按照说明从这里设置了支持库, 但在我将Library项目附加到我的项目后,gen目录中的R.java消失了.

另外我在控制台中遇到了一些错误,例如:

[2013-09-02 00:08:26 - gitarshopAndroidClient] /usr/local/external/android-sdk-linux/extras/android/support/v7/appcompat/res/values-v14/styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.
[2013-09-02 00:08:26 - gitarshopAndroidClient] /usr/local/external/android-sdk-linux/extras/android/support/v7/appcompat/res/values-v14/styles_base.xml:28: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar'.
[2013-09-02 00:08:26 - gitarshopAndroidClient] /usr/local/external/android-sdk-linux/extras/android/support/v7/appcompat/res/values-v14/styles_base.xml:32: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.Solid'.
Run Code Online (Sandbox Code Playgroud)

任何的想法?

android android-appcompat r.java-file android-support-library

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

使用JarJar重新打包工具

我已经将Web应用程序部署到Google应用程序引擎,而我的Web服务使用了jersey 1.14框架.当我尝试在GAE上使用或调用Web服务时,我得到了一个java.lang.IncompatibleClassChangeError:实现类.我四处搜索并意识到,球衣1.14取决于asm 3.1和谷歌应用程序引擎使用asm 4.0并意识到我必须使用JarJar打包依赖关系来解决这个问题,但我不知道如何做到这一点与JarJar.我发现的教程非常神秘,面向体验程序员.所以有人可以发布一个面向初学者的教程,或者指导我完成解决这个问题的步骤.

java google-app-engine jersey

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

Facebook Javascript SDK未被捕获TypeError:无法读取未定义的属性"userID"

我正在尝试使用Facebook JavaScript SDK实现授权功能.当我运行它时,检查控制台我看到错误.

uncaught TypeError: Cannot read property 'userID' of undefined 
Run Code Online (Sandbox Code Playgroud)

代码段

<div id="fb-root"></div>
<!-- Load the Facebook JavaScript SDK -->
<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
var appId = 'APP_ID';
var uid;

// Initialize the JS SDK
FB.init({
 appId: '413026618765431',
 cookie: true,
});

// Get the user's UID
FB.getLoginStatus(function(response) {
 uid = response.authResponse.userID ? response.authResponse.userID : null;
});

function authUser() {
 FB.login(function(response) {
   uid = response.authResponse.userID ? response.authResponse.userID : null;
 }, {scope:'email,publish_actions'});
}
</script>
Run Code Online (Sandbox Code Playgroud)

javascript facebook-javascript-sdk

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

无法使用PCLStorage或Xamarin Forms Labs在Android文件系统中创建文件夹/文件

我正在使用Xamarin平台开发Android应用程序,我试图在我的本地存储上创建一个文件夹,但我没有成功.

首先,我尝试通过Xamarin Forms Labs创建的FileManager类使用System.IO命名空间.我传递"/ storage/emulated/0 /`"路径的函数片段.

        public void CreateDirectory(string path)
        {
            this.isolatedStorageFile.CreateDirectory(path);
        }

        public Stream OpenFile(string path, FileMode mode, FileAccess access)
        {
            return (Stream)this.isolatedStorageFile.OpenFile(path, (System.IO.FileMode)mode, (System.IO.FileAccess)access);
        }
Run Code Online (Sandbox Code Playgroud)

这不起作用,因此我选择使用PCLStorage库进行跨平台文件操作.我试过这段代码.

IFolder rootFolder = FileSystem.Current.LocalStorage;
folder = await rootFolder.CreateFolderAsync("wakesocial",
                CreationCollisionOption.OpenIfExists);
Run Code Online (Sandbox Code Playgroud)

没工作.我导航到内部存储的根目录,我没有看到该文件夹​​.

所以错误似乎并没有发生,因为使用的库是Android特有的.我已经在清单中读取和写入外部存储.所以问题是.应用程序是否有权在存储设备的根级别创建文件或文件夹,或者是否必须在特定位置创建文件或文件夹,例如在Android/data/packagename中

c# android xamarin

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

使用渐变背景在css中创建三角形

我试图用渐变背景在css中创建一个三角形.我还没有取得任何成功.有没有办法做到这一点,以实现下图中所见的效果.(附加到错误密码错误框的三角形.)

在Photoshop中设计 在此输入图像描述

这是我到目前为止在HTML和CSS中的设计.

在此输入图像描述

这是我目前对三角形的css.

.error-triangle {
    wwidth: 0;
    height: 0;
    border-top:    10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right:  10px solid blue;
    margin-top: 64px;
    margin-left: 350px;
    position: fixed;
    -webkit-box-shadow: 0 0 3px rgba(102,65,65,.25), 2px 3px 5px rgba(70,34,34,.25), inset 1px 2px rgba(255,255,255,.25);
       -moz-box-shadow: 0 0 3px rgba(102,65,65,.25), 2px 3px 5px rgba(70,34,34,.25), inset 1px 2px rgba(255,255,255,.25);
            box-shadow: 0 0 3px rgba(102,65,65,.25), 2px 3px 5px rgba(70,34,34,.25), inset 1px 2px rgba(255,255,255,.25);
    background-image: -webkit-linear-gradient(bottom, #eb6767, #d94040 35%, #eb6767);
    background-image:    -moz-linear-gradient(bottom, #eb6767, #d94040 35%, #eb6767);
    background-image: …
Run Code Online (Sandbox Code Playgroud)

css psd css3 css-shapes

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

如何预填充Green DAO sqlite数据库

我即将使用Green DAO ORM工具.我将不得不在我的数据库中插入大约六百行的数据.我想知道有一种方法可以使用某种形式的sqlite数据库管理工具或脚本来预填充数据库.我不想手动添加这些实体等等.在android代码中.这将太繁琐和耗时.

database sqlite android populate greendao

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

来自Asp.Net Web Api异步/任务调用的正确堆栈跟踪

当我正在使用Web Api调用的客户端时发生错误.问题是我回来的堆栈跟踪有点不可读,没有行号,所以我不知道在哪里看.这是作为Json响应返回的.

 "message": "An error has occurred.",
"exceptionMessage": "Object reference not set to an instance of an object.",
"exceptionType": "System.NullReferenceException",
"stackTrace": "   at WakeSocial.Gateway.WebApi.Host.Controllers.NotificationsController.<Response>d__7.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__3`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at …
Run Code Online (Sandbox Code Playgroud)

c# asp.net exception async-await asp.net-web-api2

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

System.TypeInitializationException:'Tips'的类型初始值设定项引发了异常

我试图访问静态列表的值.但是,当我尝试这样做时,抛出此异常.

System.TypeInitializationException:'Tips'的类型初始值设定项引发了异常. - > System.NullReferenceException:对象引用未设置为对象的实例

带有列表的类.

    public static class Tips
{
    //private List<Tip> roadtips = new List<Tip>();
    public static List<Tip> tips { get; set; }

     static Tips()
    {
        tips.Add(new Tip("Don't use your mobile phone whilst driving", "Making or receiving a call, even using a 'hands free' phone, can distract your attention from driving and could lead to an accident. "));
        tips.Add(new Tip("Children", "Children often act impulsively, take extra care outside schools, near buses and ice cream vans when they might …
Run Code Online (Sandbox Code Playgroud)

c# list static-constructor windows-phone-7

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

Android应用程序名称不会在应用程序抽屉中显示

我通过更改清单的应用程序节点(AndroidManifest.xml)中的字段来关注更改Android应用程序名称的本教程android:label.

应用节点:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.pps" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <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)

strings.xml - 包含不同字符串名称的XML文件.

<resources>
<string name="app_name">PPS</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_main"></string>
</resources>
Run Code Online (Sandbox Code Playgroud)

完成此任务后,该名称仍然无法显示.这是我在运行应用程序并将其安装在我的测试设备上时看到的内容.

仅限应用程序图标  无名

当我android:label通过添加文本来更改活动节点中的当前值时发生了一个奇怪的事情<string name="title_activity_main"></string>,应用程序似乎继承了它的名称.为什么会发生这种情况?我是否错误地宣布了什么?有些价值观会发生冲突吗?

更新:

当我选择"管理应用程序"时,我实际上看到了应用程序的名称.

在此输入图像描述

android android-layout

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

Gson注释不适用于我的模型。

我正在使用GSON将Java模型转换为JSON,以便可以将其存储在Windows Azure Mobile上。这是我使用注释,获取器和设置器创建的模型。但是它没有被存储。执行此操作时是否应遵循特殊的命名约定?

public class Alarm
{
@com.google.gson.annotations.SerializedName("id")
private int alarmId;

@com.google.gson.annotations.SerializedName("completed")
private Boolean completed;

@com.google.gson.annotations.SerializedName("time")
private String time;

@com.google.gson.annotations.SerializedName("days")
private int days;

@com.google.gson.annotations.SerializedName("alarm_status")
private String alarmStatus;

@com.google.gson.annotations.SerializedName("alarm_name")
private String alarmName;

@com.google.gson.annotations.SerializedName("milliseconds")
private int milliseconds;

@com.google.gson.annotations.SerializedName("filename")
private String filename;
/*
@com.google.gson.annotations.SerializedName("requester_id")
private String requesterId;

@com.google.gson.annotations.SerializedName("requestee_id")
private String requesteeId;

@com.google.gson.annotations.SerializedName("file_format")
private String fileFormat;

@com.google.gson.annotations.SerializedName("date_set")
private String dateSet;




public Alarm()
{

}

/**
 * Getters and setters
 *
 */
public int getAlarmId() {
    return alarmId;
}

public void setAlarmId(int alarmId) {
    this.alarmId …
Run Code Online (Sandbox Code Playgroud)

java serialization gson azure-mobile-services

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

当泛型函数有两种返回类型时,它是什么意思?

我正在阅读一个教程,我发现了这个特殊的代码.

 private <V> V fromJson(HttpRequest request, Class<V> target) throws IOException {
    Reader reader = request.bufferedReader();
    try {
        return GSON.fromJson(reader, target);
    } catch (JsonParseException e) {
        throw new JsonException(e);
    } finally {
        try {
            reader.close();
        } catch (IOException ignored) {
            // Ignored
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我注意到fromJson函数有两种返回类型?我有泛型的基本概念及其工作原理.我无法理解的是如何指定两种类型以及该函数如何知道在调用时将值赋给哪种类型.

java generics

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