亲爱,
在我的xamarin表单中,项目按钮文本始终以大写格式显示.但我在xaml中提供大写和小写字母.当我构建解决方案时,所有字母都变为大写.
任何解决方案 提前致谢.
我已将Plugin.MediaManager
和添加Plugin.MediaManager.Forms
到我的xamarin forms
项目中以播放视频。
CrossMediaManager.Current.Init(this);
Run Code Online (Sandbox Code Playgroud)
当我尝试添加上面的代码时,它显示错误(方法 Init() 没有重载;)
但是在使用以下代码行运行项目时,在 android 上出现异常。
CrossMediaManager.Current.Init();
Run Code Online (Sandbox Code Playgroud)
System.NotImplementedException: '此功能未在此程序集的可移植版本中实现。您应该从主应用程序项目中引用 NuGet 包,以便引用特定于平台的实现。
IOS 和 UWP 应用程序运行良好,只有 android 项目有此问题。请帮我解决这个问题。
我有 2 个应用程序( A 和 B )使用 Xamarin.Forms 开发。我需要从应用程序 B 打开应用程序 A。
我按照这个线程尝试过如下:
在视图中
var appname = @"otherappId";
var result = await DependencyService.Get<IAppHandler>().LaunchApp(appname);
Run Code Online (Sandbox Code Playgroud)
界面
public interface IAppHandler
{
Task<bool> LaunchApp(string uri);
}
Run Code Online (Sandbox Code Playgroud)
安卓
[Activity(Label = "OpenAppAndroid")]
public class OpenAppAndroid : Activity, IAppHandler
{
public Task<bool> LaunchApp(string uri)
{
bool result = false;
try
{
var aUri = Android.Net.Uri.Parse(uri.ToString());
var intent = new Intent(Intent.ActionView, aUri);
Xamarin.Forms.Forms.Context.StartActivity(intent);
result = true;
}
catch (ActivityNotFoundException)
{
result = false;
}
return Task.FromResult(result); …
Run Code Online (Sandbox Code Playgroud) 以下是在C#中将java datetamp(13位数字)转换为date(1520488577604
至3/12/2018 8:07:02 PM
)的代码。
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
.AddMilliseconds((long)value) // put your value here
.ToLocalTime().ToString("g");
Run Code Online (Sandbox Code Playgroud)
我需要反转此功能,需要从转换3/12/2018 8:07:02 PM
为1520488577604
。
我正在寻找位于页面底部的标签。我尝试了xamarin形式的TabbedPage,但是对于ios,只有选项卡位于底部,而对于android和Windows,选项卡则显示在顶部。有什么方法可以实现此功能?
我在我的用户界面中使用编辑器。但是黑色的下划线很烦人,有什么办法可以去掉那个下划线吗?
提前致谢
我想从我的应用程序复制一个值并将其粘贴到同一应用程序的任何其他位置或应用程序外部。
我已经在这个线程中寻找答案:
所以我使用Clipboard.SetText(txtClipboard.Text);
并添加了using System.Windows.Forms;
命名
using System.Windows;
空间。但是,我收到错误:
当前上下文中不存在剪贴板。
需要任何 nuget 包吗?
提前致谢
我的 xamarin 表单项目中有一个如下所示的编辑器。
当我在上面输入消息时,我需要根据字符数增加编辑器的高度。
这是我底部的完整代码,我添加了一个框架布局,使入口角为圆形:
<StackLayout
HorizontalOptions="FillAndExpand"
x:Name="tweetBox"
VerticalOptions="End"
Margin="0,0,0,10"
BackgroundColor="#f2f2f2"
Orientation="Horizontal">
<Image
WidthRequest="25"
HeightRequest="25"
VerticalOptions="Center"
Source="ic_add_blue_xx.png"
Margin="10,5,-5,5">
<Image.GestureRecognizers>
<TapGestureRecognizer
Tapped="ShowPicureOptions"
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Frame
Padding="0"
Margin="5,5,0,5"
HorizontalOptions="FillAndExpand"
CornerRadius="10">
<Editor
x:Name="tweetText"
HorizontalOptions="FillAndExpand"
VerticalOptions="Center"
FontFamily="Bold"
BackgroundColor="White"
TextColor="#959595"
AutoSize="TextChanges"
PlaceholderColor="#959595"
Placeholder=" Enter Message..."/>
</Frame>
<Image
VerticalOptions="Center"
WidthRequest="25"
Margin="5,5,10,5"
HeightRequest="25"
HorizontalOptions="End"
Source="ic_send_xx.png">
<Image.GestureRecognizers>
<TapGestureRecognizer
Tapped="SendTweet_Icon_Clicked"
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
</StackLayout>
Run Code Online (Sandbox Code Playgroud) 亲爱的,
我在我的项目中使用 DisplayAlert 来显示没有互联网连接警报。不幸的是,它不起作用。
它在另一部分工作得很好。我不知道它为什么会这样。
我的代码:
if (Utility.IsInternet())
{
UserTweetsList();
}
else
{
Debug.WriteLine("Enter no internet block");
DisplayAlert("Alert", "No internet connection", "Ok");
}
Run Code Online (Sandbox Code Playgroud)
代码进入 else 块并在输出中打印“Enter no internet block”,但不显示警报消息。
造成这种情况的可能原因有哪些?
提前致谢....
我在网格内有 2 行,因为第一行具有固定大小。我正在尝试在这里应用该OnIdiom
功能。尝试如下:
<Grid.RowDefinitions>
<RowDefinition>
<RowDefinition.Height>
<OnIdiom x:TypeArguments="x:Double">
<OnIdiom.Phone>30</OnIdiom.Phone>
<OnIdiom.Tablet>60</OnIdiom.Tablet>
</OnIdiom>
</RowDefinition.Height>
</RowDefinition>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
Run Code Online (Sandbox Code Playgroud)
但在错误列表中出现以下错误:
No property, bindable property, or event found for 'Height', or mismatching type between value and property.
Run Code Online (Sandbox Code Playgroud)
RowDefinition 高度 OnIdiom 属性的正确格式是什么?
如何为处于禁用状态的条目添加click事件?
我尝试使用如下手势识别器:
<Entry
TextColor="Black"
x:Name="phone">
<Entry.GestureRecognizers>
<TapGestureRecognizer
Tapped="StartCall"
NumberOfTapsRequired="1">
</TapGestureRecognizer>
</Entry.GestureRecognizers>
</Entry>
void StartCall(object sender,EventArgs args)
{
DisplayAlert("Alert","Hi","ok");
}
Run Code Online (Sandbox Code Playgroud)
点击进入时没有在ui上显示警报.
提前致谢
我正在尝试为我的以下JSON数据实现listview分组。
JSON示例:
{
"cbrainBibleBooksHB":[ {
"book":"2 John",
"cbrainBibleTOList":[
{
"bookName":"2 John",
"chapter":"1",
"pageUrl":"/edu-bible/9005/1/2-john-1"
},
{....}
]
},
{
"book":"3 John",
"cbrainBibleTOList":[
{
"bookName":"3 John",
"chapter":"1",
"pageUrl":"/edu-bible/9007/1/3-john-1"
},
{...}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试按书名对JSON数据进行分组。
我尝试如下:
模型:
public class BibleTestament
{
public List<CbrainBibleBooksHB> cbrainBibleBooksHB { get; set; }
}
public class CbrainBibleBooksHB : ObservableCollection<CbrainBibleTOList>
{
public string book { get; set; }
public List<CbrainBibleTOList> cbrainBibleTOList { get; set; }
}
public class CbrainBibleTOList
{
public string chapter { get; set; }
public …
Run Code Online (Sandbox Code Playgroud) xamarin.forms ×11
android ×1
c# ×1
clipboard ×1
copy-paste ×1
editor ×1
grid ×1
height ×1
ios ×1
tabbedpage ×1
uwp ×1