小编mor*_*tzg的帖子

关闭android studio中打开的选项卡的快捷方式

关闭android studio中打开的选项卡的快捷方式是什么?

我是android工作室的新手.我尝试用CTRL+ W.它不起作用.我搜索了一会儿.但我还没有得到它.任何人请提供关闭打开的选项卡的快捷方式.

android-studio

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

如何发送和接收广播消息

我试图在选项卡内的两个活动之间传递数据.我正在尝试使用sendBroadcast().设置断点我永远不会到达onReceive().

表现:

<activity
    android:name=".WebResults"
    android:label="@string/app_name">

    <intent-filter>
        <action android:name="com.toxy.LOAD_URL" />
    </intent-filter>         
</activity>
Run Code Online (Sandbox Code Playgroud)

活动发件人:

Intent intent=new Intent(getApplicationContext(),WebResults.class);
intent.setAction("com.toxy.LOAD_URL");
intent.putExtra("url",uri.toString());
sendBroadcast(intent);
Run Code Online (Sandbox Code Playgroud)

活动接收者:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);    
    IntentFilter filter = new IntentFilter("com.toxy.LOAD_URL");
    this.registerReceiver(new Receiver(), filter);
}

private class Receiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context arg0, Intent arg1) {
        String url = arg1.getExtras().getString("url");
        WebView webview =(WebView)findViewById(R.id.webView);
        webview.loadUrl(url);
    }
}
Run Code Online (Sandbox Code Playgroud)

android message-passing broadcast

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

Python3:JSON POST请求没有请求库

我想只使用本机Python库将JSON编码数据发送到服务器.我喜欢请求,但我根本无法使用它,因为我不能在运行脚本的机器上使用它.我需要在没有的情况下这样做.

newConditions = {"con1":40, "con2":20, "con3":99, "con4":40, "password":"1234"} 
params = urllib.parse.urlencode(newConditions)
params = params.encode('utf-8')

req = urllib.request.Request(conditionsSetURL, data=params)
urllib.request.urlopen(req)        
Run Code Online (Sandbox Code Playgroud)

我的服务器是本地Wamp服务器.我总是得到一个

urllib.error.HTTPError:HTTP错误500:内部服务器错误

100%确定不是服务器问题,因为同一台机器上具有相同网址的相同数据与同一服务器一起使用请求库.(也适用于发送POST请求的程序).我无法找出它为什么这样做......我自己编写了API.

python json urllib

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

Android:更改活动的背景颜色(主视图)

我想改变主视图(不是按钮或文本视图)的背景颜色,只是通常是黑色的真实背景...我得到了这段代码:

view.setBackgroundColor(0xfff00000);
Run Code Online (Sandbox Code Playgroud)

这是在里面OnClickListener,但它只是改变了Button的背景.

java android colors

23
推荐指数
3
解决办法
11万
查看次数

ASP.NET Core:JSON配置GetSection返回null

我有一个appsettings.json看起来像这样的文件:

{
    "MyConfig": {
        "ConfigA": "value",
        "ConfigB": "value"
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的Startup.cs建设中IConfiguration:

public ConfigurationRoot Configuration { get; set; }

public Startup(ILoggerFactory loggerFactory, IHostingEnvironment environment)
{
      var builder = new ConfigurationBuilder()
                     .SetBasePath(environment.ContentRootPath)
                     .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)                             
                     .AddEnvironmentVariables();

      Configuration = builder.Build();
}

public void ConfigureServices(IServiceCollection services)
{
      //GetSection returns null...
      services.Configure<MyConfig>(Configuration.GetSection("MyConfig"));
}
Run Code Online (Sandbox Code Playgroud)

Configuration.GetSection("MyConfig")总是返回null,尽管我的JSON文件中存在该值.Configuration.GetSection("MyConfig:ConfigA")工作得很好.

我究竟做错了什么?

c# asp.net configuration json

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

Chrome 无法正确显示我的表情符号

我正在使用Version 68.0.3440.106 (Official Build) (64-bit)Chrome macOS Sierra 10.12.6

\n\n

我有以下代码:

\n\n

<div class="emoji">\xe2\x98\xba\xef\xb8\x8f</div>

\n\n

它正在渲染:在此输入图像描述

\n\n

而不是这个:在此输入图像描述

\n\n

它只发生在这个特定的表情符号上。其他人都工作正常。为什么?

\n

html css fonts google-chrome emoji

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

ASP.NET:检查是否从迁移运行

我有一些ConfigureServices运行迁移时失败的代码:

dotnet ef migrations list
Run Code Online (Sandbox Code Playgroud)

我正在尝试添加证书,但找不到文件(在整体启动项目时可以使用)。有没有办法做这样的事情:

if (!CurrentEnvironment.IsMigration()) {
    doMyStuffThatFailsInMigration()
}
Run Code Online (Sandbox Code Playgroud)

这样,我可以保留我的代码,但是在不运行迁移时仅执行它即可。

谢谢

c# asp.net entity-framework ef-migrations asp.net-core

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

Angular Router:获取与当前路由匹配的路由配置

我的 Angular 项目中有以下路由配置:

export const routes: Routes = [
  { path: 'a/:id', loadChildren: './a/a.module#AModule', data: {a: a}},
  { path: 'b/:id',  loadChildren: './b/b.module#BModule', data: {a: b}}
];
Run Code Online (Sandbox Code Playgroud)

现在我可以像这样获取路由配置:

this.router.config //outputs the above array
Run Code Online (Sandbox Code Playgroud)

显示,但由于配置具有未解析的路径并且路由器保存已解析的路径,因此this.router.urla如何正确识别正确的路径。Route

我想要这样做的原因是访问my所在data的位置,而不是组件本身(角度文档说该对象只能由路由组件本身访问。app.componentrouter-outletdata

angular-routing angular

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

Android:任务执行失败":app:dexDebug"

我的Android Studio项目有问题,编译得很好,我不知道我做了什么打破它.

错误:任务':app:dexDebug'的执行失败.com.android.ide.common.internal.LoggedErrorException:无法运行命令:C:\ Users\Moritz\AppData\Local\Android\sdk\build-tools\21.1.1\dx.bat --dex --no- optimize --output C:\ Users\Moritz\AndroidStudioProjects\Expenses1\app\build\intermediates\dex\debug --input-list = C:\ Users\Moritz\AndroidStudioProjects\Expenses1\app\build\intermediates\tmp\dex\debug\inputList.txt错误代码:1

build.gradle(module:app)

compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'

compile ('com.larswerkman:HoloColorPicker:1.4')
compile ('com.melnykov:floatingactionbutton:1.1.0')
compile 'net.sf.opencsv:opencsv:2.3'
compile 'com.itextpdf:itextpdf:5.0.6'
compile 'joda-time:joda-time:2.7'
compile 'com.github.m1s73r:LolliPin:v1.3'
compile 'com.github.PhilJay:MPAndroidChart:v2.0.9'
compile 'net.objecthunter:exp4j:0.4.5'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
Run Code Online (Sandbox Code Playgroud)

android gradle

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

能够自定义有角材质中的matstepper中的图标

当前,用户只能使用“材料” create和“ done图标”作为步骤标题。这些更改提供了通过提供ng-template覆盖来自定义图标的功能。所以我找到了更新, 但是当我将其用作

<mat-horizontal-stepper [linear]="isLinear">
  <mat-step [stepControl]="firstFormGroup">
    <form [formGroup]="firstFormGroup">
      <ng-template matStepLabel>Fill out your name</ng-template>
      <ng-template matStepperIcon="edit">
        <custom-icon>edit</custom-icon>
       </ng-template>
      <mat-form-field>
        <input matInput placeholder="Last name, First name" formControlName="firstCtrl" required>
      </mat-form-field>
      <div>
        <button mat-button matStepperNext>Next</button>
      </div>
    </form>
  </mat-step>
  <mat-step>
    <ng-template matStepLabel>Done</ng-template>
    You are now done.
    <div>
      <button mat-button matStepperPrevious>Back</button>
    </div>
  </mat-step>
</mat-horizontal-stepper>
Run Code Online (Sandbox Code Playgroud)

我得到这个错误

Uncaught Error: Template parse errors:
    'custom-icon' is not a known element:
    1. If 'custom-icon' is an Angular component, then verify that it is part …
Run Code Online (Sandbox Code Playgroud)

angular-material angular

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