小编Arv*_*iya的帖子

有没有可以扫描BLE信标的可穿戴设备?

这个想法是从手表扫描信标,然后将数据发送到手机。然后手机应用程序将估计手表的位置。

我猜 Android Wear 提供了这个功能,但最便宜的型号是 Sony SmartWatch 3,售价 130 美元。当前的 Pebble API 是否支持手表的 BLE 扫描?

android sony-smartwatch pebble-watch ibeacon wear-os

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

无论标签标题如何,如何更改导航栏标题

我将导航栏上的页面标题设置为

public Homework ()
{
   InitializeComponent ();
   Title = "Homework";     
}
Run Code Online (Sandbox Code Playgroud)

该页面的子页面标签页,其中标签已经有标题“TAB1”。

现在,当我Homework.csTab1打开页面时,上面的代码将 Tab 标题更改为 Homework,导航栏标题也更改为“Homework”。我不想更改标签标题。

MyTabbed 页面代码使用

   public class MyTabbedPage : TabbedPage
    {
        public MyTabbedPage()
        {
           this.CurrentPageChanged +=delegate
           {        
             this.Title = this.CurrentPage.Title;
           };     
        }
    }
Run Code Online (Sandbox Code Playgroud)

查看一些方便的片段

public App ()
{
    InitializeComponent();
    MainPage = new NavigationPage(new LoginPage());          
}
Run Code Online (Sandbox Code Playgroud)

单击 LoginContentPage 按钮

btnLogin.Clicked +=async delegate {
 await Navigation.PushAsync(new ParentDashboard(), false);
};
Run Code Online (Sandbox Code Playgroud)

ParentDashboard 包含选项卡

public partial class ParentDashboard : MyTabbedPage
{
    public ParentDashboard()
    {
        InitializeComponent();      
        Title="Home"; …
Run Code Online (Sandbox Code Playgroud)

c# xamarin.ios xamarin.forms

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

Xamarin Form 中的 PinchGesture 像 Instagram 移动提要屏幕一样缩放

我正在尝试在 xamarin 跨平台应用程序中实现类似的缩放功能,例如 Instagram 移动应用程序提要屏幕。实际上我想ImageViewListView单元格内部添加捏合手势,如果用户捏合图像,它应该放大ListView。一旦用户松开捏它应该自动调整到原始大小并适合单元格。
帮助我并提供解决方案。

以下示例代码工作但它在单元格内缩放,它不像 Instagram 缩放重叠/叠加效果。

XAML 代码

<ListView x:Name="listView" ItemSelected="PlayerList_OnItemSelected"  HasUnevenRows="false" RowHeight="300" BackgroundColor="#F6F3F6" 
RelativeLayout.XConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Width, Factor=0}" 

RelativeLayout.YConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Height, Factor=.09}"

RelativeLayout.HeightConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Height, Factor=.91}"

RelativeLayout.WidthConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Width, Factor=1}">
<ListView.ItemTemplate>
    <DataTemplate>
<ViewCell >
<Frame Margin="5" Padding="5"  OutlineColor="White" HasShadow="true">

<RelativeLayout >
<Label Font="Bold,20" Text="{Binding name}" TextColor="Black"
        RelativeLayout.YConstraint="{ConstraintExpression 
        Type=RelativeToParent,
        Property=Height,
        Factor=.0}"
        RelativeLayout.XConstraint="{ConstraintExpression 
        Type=RelativeToParent, 
        Property=Width, 
        Factor=.02}"
        RelativeLayout.WidthConstraint="{ConstraintExpression 
        Type=RelativeToParent, 
        Property=Width,
        Factor=.9}"/>

    <local:PinchToZoomContainer RelativeLayout.WidthConstraint="{ConstraintExpression
        Type=RelativeToParent,
        Property=Width, 
        Factor=1}"
        RelativeLayout.XConstraint="{ConstraintExpression
        Type=RelativeToParent,
        Property=Width, 
        Factor=0}" …
Run Code Online (Sandbox Code Playgroud)

c# zooming pinch xamarin xamarin.forms

5
推荐指数
0
解决办法
411
查看次数

使用带有标签可见性 Xamarin 表单的转换器时如何将默认值设置为 false

我正在使用具有Label'sIsVisible属性的转换器。

<Label IsVisible="{Binding products, Converter={StaticResource EmptyCollectionToBoolConverter}}" Text="No data found">  
Run Code Online (Sandbox Code Playgroud)

如果products为空则EmptyCollectionToBoolConverter返回true,否则返回false。第一次加载屏幕时,“未找到数据”消息会出现几分之一秒,然后数据就会加载。

我想修复它,只有当何时products为空时我才需要显示标签。我该怎么做?

xaml converters xamarin xamarin.forms

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

如何在Xamarin中更改标签文本

我对Xamarin表格比较陌生。我发现我无法从后面的代码中更改标签文本。通常我会的myLabel.text = variable。这在Xamarin中有效吗?如果可以,为什么此代码不更改文本?

Label_ControlSW.Text = controlSW_Out;
            Label_BLESW.Text = bleSW_Out;
            Label_Mode.Text = mode_Out;
Run Code Online (Sandbox Code Playgroud)

XAML文件

<Label x:Name="Label_ControlSW" Grid.Row="1" Grid.Column="1" HorizontalOptions="Center"  VerticalOptions="Center" FontSize="17" TextColor="White"/>
                <Label x:Name="Label_BLESW" Grid.Row="2" Grid.Column="1" HorizontalOptions="Center"  VerticalOptions="Center" FontSize="17" TextColor="#525252"/>
                <Label x:Name="Label_Mode"  Grid.Row="4" Grid.Column="1" HorizontalOptions="Center"  VerticalOptions="Center" FontSize="17" TextColor="White"/>
Run Code Online (Sandbox Code Playgroud)

c# xaml xamarin xamarin.forms

4
推荐指数
2
解决办法
9713
查看次数

Xamarin 中的 [assembly: Dependency()] 是什么?

我是 Xamarin 的新手。我正在学习一个教程,在那

[assembly: Dependency(typeof())]
Run Code Online (Sandbox Code Playgroud)

被使用。没看懂这行代码的作用是什么。请解释它的功能。

以下是代码。

[assembly: Dependency(typeof(SQLiteAndroid))]

namespace XamTestThree.Droid.Data {
    public class SQLiteAndroid :ISQLite{
        public SQLiteAndroid() { }
        public SQLite.SQLiteConnection GetConnection()
        {
            var sqlLiteFileName = "TestDB.db3";
            string documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var path = Path.Combine(documentPath, sqlLiteFileName);
            var conn = new SQLite.SQLiteConnection(path);
            return conn; 

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# android xamarin xamarin.forms

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

尽管请求处理成功,但从发布请求中获取空响应

我正在post使用发出请求httpClient,但null通过请求处理成功获得响应。

serviceClass.ts 文件

this.httpOptions = {
  headers: new HttpHeaders(
    { 
      'Content-Type': 'application/json; charset=utf-8',
      'tenant-code' : 'VdoFWiHL8RFR8fRGNjfZI=',
      'Authorization': 'Basic ' + btoa('pass:username')
    })
}

public Reprocess(ObjProduct) {
var Jobj=JSON.stringify(ObjProduct);
return this._http.post(this.ReprocessUrl,Jobj,this.httpOptions)
}
Run Code Online (Sandbox Code Playgroud)

当我在 Component 中调用上述方法时,我收到了null来自 API 的响应。

组件代码

var op = this.objService.reprocess(this.reprobj);
console.log("output: ", op);
Run Code Online (Sandbox Code Playgroud)

op是完全_scaler=false无法理解的,它正在显示等。如何获得服务呼叫的正确状态?

编辑 1:当我从邮递员那里提出同样的请求时,得到 status Ok 200

编辑 2:下面的代码也给出了null结果(根据@Spart_Fountain 的回答)

var op= this.restApi.Reprocess(this.reprobj).subscribe((data:any) => {
console.log("data "+ data);    
});
Run Code Online (Sandbox Code Playgroud)

邮递员标题截图

在此处输入图片说明

httprequest typescript angular

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

如何在 Angular 中自动刷新页面

如果我的页面打开,我想自动重新加载我的页面(自动回发以重新加载表数据)。为此,我编写了一些代码,但不起作用。请参阅下面我的代码

import { Component, OnInit } from '@angular/core';
import { Observable,Subscription, interval  } from 'rxjs';

export class ProductsComponent implements OnInit {
  private updateSubscription: Subscription;

  ngOnInit() {
     this.updateSubscription = interval(3000).subscribe(
     (val) => { this.getProducts()});

    });
  }

  private getProducts()
  {
    this.employeeService.getProducts().subscribe((data:any) => {
      console.log(data);
     this.products=data;});

  }

}
Run Code Online (Sandbox Code Playgroud)

getProducts调用rest Api。我怎样才能让它工作?

typescript angular

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

ng :术语“ng”未被识别为 cmdlet 的名称,函数 Visual Studio Code Terminal

在 VS Code 中运行命令ng build时出现错误

PS D:\Dashboard\Test1> ng build
ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if   
a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ng build
+ ~~
    + CategoryInfo          : ObjectNotFound: (ng:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)

我已经添加了这些环境变量 Path

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
C:\Users\Avind\AppData\Local\Programs\Microsoft VS Code\bin;
C:\Users\Avind\AppData\Roaming\npm;
Run Code Online (Sandbox Code Playgroud)

我怎样才能摆脱这个问题?

注意:我 …

terminal visual-studio-code angular

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

如何制作Bootstrap下拉菜单的垂直滚动条

我正在开发 Angular 应用程序。我的下拉菜单太长了,我无法滚动,页面也结束了。这里使用Bootstrap 4.5.0. 如何在其中添加垂直滚动条

这是我的代码

<div ngbDropdown class="d-inline-block">
<button class="btn btn-secondary btn-sm dropdown-toggle" id="dropdownMap" ngbDropdownToggle>
 {{ selectedCountry}}
</button>
<div ngbDropdownMenu aria-labelledby="dropdownMap">
  <ng-container *ngFor="let country of mapData">
  <button ngbDropdownItem class="dropdown-item" (click)="mapCountry_selected(country)" >
    {{country.post}}
    </button>
  </ng-container>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)

我尝试过这个但不起作用

.ngbDropdownMenu
 {
   max-height: 200px;
   overflow-y: scroll;
 }
 
 .ngbDropdownItem
 {
   max-height: 200px;
   overflow-y: scroll;
 }
.ngbDropdown
{
max-height: 200px;
overflow-y: scroll;
}
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap ng-bootstrap angular

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