小编Kar*_*aru的帖子

无法在android min sdk版本中使用forEach和lambda小于24

我在我的android项目中使用jack编译器.我的min sdk设置为18.我无法在代码中使用forEach和lambda.它要求我将我的min sdk更改为24或更高.我希望通过JACK编译器的集成,我可以轻松地将这个forEach与lambda一起使用.除了碰撞最小的sdk之外,还有其他工作吗?

foreach lambda android java-8

9
推荐指数
0
解决办法
931
查看次数

单击选项卡时单击侦听器 - angular2和ng bootstrap

我有以下html代码段.我正在使用angular2,ng-bootstrap ng选项卡.我的问题是如何在单击选项卡时调用方法单击?我添加(单击)但我看到当我单击选项卡时,根本没有调用fetchNews()方法.我究竟做错了什么?

  <ngb-tab title="Active" (click)="fetchNews('active')">
    <ng-template ngbTabContent>
      <table class="table table-sm table-striped">
        <thead>
        <tr>
          <th>Title</th>
          <th>Description</th>
          <th>Attachment</th>
          <th>Start Date</th>
          <th>End Date</th>
          <th>Actions</th>
        </tr>
        </thead>
        <tr *ngFor="let item of news">
          <td>{{item.title}}</td>
          <td>{{item.description | ellipsis:25}}</td>
          <td>{{item.attachmentUrl | ellipsis:25}}</td>
          <td>{{item.startDate | date: 'MM/dd/yyyy hh:mm a'}}</td>
          <td>{{item.endDate | date: 'MM/dd/yyyy hh:mm a'}}</td>
          <td>
            <button type="button" class="btn btn-secondary btn-sm" (click)="showNewsModal('active',item, true)">
              Modify
            </button>
          </td>
        </tr>
      </table>
    </ng-template>
  </ngb-tab>
Run Code Online (Sandbox Code Playgroud)

tabs ng-bootstrap angular

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

ngbpopover 文本的新行

我正在使用 Angular 2 和 ng bootstrap popover 功能。以下是我的 html。我有 infoIconText 变量,它有一些新行 \n 字符。但是,当我看到弹出窗口文本时,我仍然无法看到新行。如何设置弹出文本的样式?有什么建议么?

<i class="fa fa-info-circle" ngbPopover="{{infoIconText}}" triggers="mouseenter:mouseleave" aria-hidden="true"></i>
Run Code Online (Sandbox Code Playgroud)

我的infoIconText如下:

this.infoIconText = "This is line 1." +
      "\nThis is line2";
Run Code Online (Sandbox Code Playgroud)

ng-bootstrap angular

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

是否可以使用引导程序根据角度屏幕尺寸设置变量值?

我在角度分量中有一个全局变量,如下所示,

visibleDays = 7
Run Code Online (Sandbox Code Playgroud)

我希望能够根据屏幕尺寸控制这个值。对于较小的设备,我希望该值为 3 而不是 7。是否可以对“sm”、“xs”设备执行此操作?

responsive-design bootstrap-4 angular

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

ng bootstrap工具提示的宽度和背景颜色

我需要修改工具提示框的宽度和背景.我怎样才能实现它?我正在使用angular2和ng bootstrap.

<i class="fa fa-info-circle info-icon-background" [ngbTooltip]="tooltipContent" aria-hidden="true" ></i>
Run Code Online (Sandbox Code Playgroud)

我已经尝试将以下内容放在我的"task-modal.component.css"css文件中,但它似乎不起作用.请帮忙.

.tooltip-inner{
  width: 400px;
  background-color: #FFFFFF;
}
Run Code Online (Sandbox Code Playgroud)

在我的角度组件中,我将css文件指定为:

@Component({
  selector: 'task-modal',
  templateUrl: './task-modal.component.html',
  styleUrls: ['task-modal.component.css'],
  providers: [TasksService]
})
Run Code Online (Sandbox Code Playgroud)

tooltip ng-bootstrap angular

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

ng 选择样式组标题和项目

我在我的 Angular 项目中使用 ng-select ( https://ng-select.github.io/ng-select#/data-sources ) 库来显示下拉列表,如下所示:

<ng-select
  [items]="flattenedSelectList"
  bindLabel="displayName"
  placeholder="Select specialty"
  notFoundText="No results found. Please try a different search criteria."
  bindValue="id"
  groupBy="type"
  [(ngModel)]="selectedSpecialtyId">
</ng-select>
Run Code Online (Sandbox Code Playgroud)

我想设置组标题以及每个组内的项目的样式?我该怎么做?

我在 .scss 文件中使用了以下内容,但它似乎没有应用更改。ng-optgroup 用于组标头,ng-option-label 用于项目。

.ng-optgroup {
  font-weight: bold;
  color: #dbe8ef;
}

.ng-option-label{
  color: red;
}
Run Code Online (Sandbox Code Playgroud)

angular-ngselect angular

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

android上的SwitchCompat渲染问题

我在我的布局之一中使用 android.support.v7.widget.SwitchCompat。我的编译 sdk 版本是 25,buildTools 版本是 25.0.1,我使用的是 25.2.0 版本的 com.android.support:design 我已经重新启动了 android studio,使缓存失效,做了清理/构建。但是,我仍然无法从我的设计视图中摆脱这个错误。知道我错过了什么吗?

这是我的风格:

    <style name="AppTheme" parent="android:Theme.Holo.Light">
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="android:textViewStyle">@style/RobotoTextViewStyle</item>
    <item name="android:editTextStyle">@style/RobotoEditTextStyle</item>
</style>

<style name="SplashTheme" parent="android:Theme.Holo.Light">
    <item name="android:windowBackground">@drawable/splash</item>
</style>

<style name="RobotoTextViewStyle" parent="android:Widget.TextView">
    <item name="android:fontFamily">sans-serif</item>
    <item name="android:textSize">@dimen/body</item>
    <item name="android:textColor">@color/colorBlack</item>
</style>

<style name="RobotoEditTextStyle" parent="android:Widget.EditText">
    <item name="android:fontFamily">sans-serif</item>
    <item name="android:textSize">@dimen/body</item>
    <item name="android:padding">@dimen/edittext_padding</item>
</style>


<style name="CustomTabLayout" parent="CustomTabLayout">
    <item name="tabIndicatorColor">@color/colorGold</item>
    <item name="tabSelectedTextColor">@color/colorGold</item>
</style>

<style name="StyledScrollerTextAppearance">
    <item name="android:textColor">@color/colorWhite</item>
</style>

<style name="CustomSwitch">@style/CustomSwitch</style>
Run Code Online (Sandbox Code Playgroud)

以下是错误。

java.lang.NullPointerException
at android.text.StaticLayout.<init>(StaticLayout.java:422)
at android.support.v7.widget.SwitchCompat.makeLayout(SwitchCompat.java:864)
at android.support.v7.widget.SwitchCompat.onMeasure_Original(SwitchCompat.java:783)
at android.support.v7.widget.SwitchCompat.onMeasure(SwitchCompat.java)
at android.view.View.measure(View.java:19731)
at android.support.constraint.ConstraintLayout.internalMeasureChildren(ConstraintLayout.java:927)
at …
Run Code Online (Sandbox Code Playgroud)

android switchcompat

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

在 ng-select 中添加搜索图标占位符而不是占位符文本?

我正在使用 ng-select 库在我的 Angular Web 应用程序中显示下拉菜单。

    <ng-select
      [items]="flattenedSelectList"
      bindLabel="displayName"
      placeholder="Select specialty"
      notFoundText="No results found. Please try a different search criteria."
      bindValue="id"
      [searchFn]="onSearch"
      groupBy="type"
      [(ngModel)]="selectedSpecialtyId">
      <ng-template ng-option-tmp let-item="item" let-search="searchTerm">
        <span [ngOptionHighlight]="search" [title]="item.displayName">
        {{item.displayName}}
        </span>
        <div class='provider-specialty' *ngIf="shouldShowDepartmentName(item)">
          {{getAreasOfExpertise(item)}}
        </div>
      </ng-template>
    </ng-select>
Run Code Online (Sandbox Code Playgroud)

我想在搜索框中放置一个搜索图标,而不是占位符文本“选择专业”。我怎样才能做到这一点?

angular-ngselect angular

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