有没有办法清除ListView中的选定项?
ListView的定义如下:
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="50dp"
android:id="@+id/example_list"
android:layout_weight="2"
android:choiceMode="singleChoice"/>
Run Code Online (Sandbox Code Playgroud)
并使用自定义适配器填充.
使用选择器突出显示所选项目:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<gradient
android:startColor="#3E5260"
android:endColor="#3E5260"
android:angle="270" />
</shape>
</item>
<item android:state_activated="true">
<shape>
<gradient
android:startColor="#3E5260"
android:endColor="#3E5260"
android:angle="270" />
</shape>
</item>
</selector>
Run Code Online (Sandbox Code Playgroud)
现在我真正拥有的是单个活动中的2个ListViews,当
在一个ListView中选择一个项目时,我想取消选择另一个ListView中的项目.
单击一个项时,两个ListView都会引发以下处理程序:
void DeviceList_Click(object sender, EventArgs e)
{
//easy enough to check which ListView raised the event
//but then I need to deselect the selected item in the other listview
}
Run Code Online (Sandbox Code Playgroud)
我尝试过这样的事情:
exampleList.SetItemChecked(exampleList.SelectedItemPosition, false);
Run Code Online (Sandbox Code Playgroud)
和
exampleList.SetSelection(-1);
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用.
我正在使用来自https://github.com/oysteinkrog/SQLite.Net-PCL的PCL版本的Sqlite.net
但是,我无法进行数据库连接设置.该SQliteAsyncConnection确实不像原来的版本不是一个字符串(路径DB),但[Func< SQLiteConnectionWithLock>.]2
怎么用这个?一般来说:如何使用这个库?我有一个核心PCL lib,可以完成iOS,Android和WP8项目的所有业务逻辑.我的理解是我可以将Sqlite-Net Async PCL放入我的PCL lib中.但似乎我必须提供一些特定于平台的东西才能让它发挥作用.
我正在Visual Studio中构建一个Android应用程序.当我尝试在Resources文件夹中构建应用程序引用项时,我得到两个错误之一.
如果我使用我的项目的命名空间前缀"Resource.Layout.[Id]"或"Resource.Id.[Id]",我收到此错误:
名称空间'[app namespace]'中不存在类型或命名空间名称'Resource'(您是否缺少程序集引用?)
如果我没有在我的命名空间前面调用Resource,它会尝试访问默认的Android.Resource类,我收到此错误:
'Android.Resource.Layout'不包含'[axml file]'的定义
有没有人遇到过这个错误?我一直在寻找一段时间,但却无法想出任何看似错误的东西.Resource.Designer文件存在.我删除了它,让它重新生成.Ids位于Resource文件中,项目根本无法识别资源类是否存在.
最初,此应用程序的命名空间以"Android"结尾.考虑到可能是问题的一部分,我将其更改为"_Android"和"AndroidApp",包括更改项目属性中的默认命名空间以及更改每个文件中的命名空间声明.但是,每次更改都会出现此错误.
我在Styles.xml文件中添加了一些项目.但是,它给了我一个错误.
这是我的代码.
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#2196F3</item>
<item name="drawerArrowStyle">@style/MyDrawerArrowStyle</item>
</style>
<style name="MyDrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">#F5F5F5</item>
<item name="spinBars">true</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
错误可以在下面的屏幕截图中看到
我们都知道移动设备是紧凑型平台,我们在构建应用程序时必须要看很多东西.它可能是任何东西,例如Memory Performance Resolutions Architecture Implementation等等.我们永远不知道什么时候和什么原因导致应用程序在玩应用程序时崩溃了一个大问题,它可能随时发生
例如应用启动,加载屏幕,API调用,绑定数据,加载图像等
相信我有时很难找到应用程序中出现问题的位置和原因.我在论坛,技术社区和团体中看到了许多与同一问题相关的帖子,人们通常在这些问题上提问:
如何识别问题及其原因?
我最近决定更新我的Xamarin工作区中的所有内容,包括所有nuget包和Xamarin表单.
我首先安装了所有最新的Xamarin.android.support软件包,这些软件包与当前版本的Xamarin表单发生了冲突,所以,决定我还需要更新Xamarin表单,删除它,安装所有其他软件包(工作很可爱) ,现在我想再次重新安装Xamarin表单,但我收到:
无法解析依赖项.'Xamarin.Android.Support.Design 23.4.0.1'与'Xamarin.Forms 2.3.0.107约束:Xamarin.Android.Support.Design(= 23.3.0)'不兼容.
有什么建议?
我需要在设置页面中显示应用程序的构建版本.
那么我怎样才能以编程方式获取versionCode和versionName从AndroidManifest.xml文件中获取.
要么
有没有办法以编程方式获取构建版本xamarin.forms.
我已经在pdf上制作了样本。该项目的链接如下所示:
https://github.com/gopalawasthi123/PdfWebView
希望这能更好地帮助你。
public void SetWebView(WebView webview,string externalUrl){
webview.Tag = "webview";
webview.Settings.JavaScriptEnabled = true;
webview.Settings.SupportZoom ();
webview.Settings.SetAppCacheEnabled(true);
webview.Settings.DomStorageEnabled = true;
webview.ZoomOut ();
webview.ZoomIn ();
webview.Settings.BuiltInZoomControls = true;
webview.Settings.LoadWithOverviewMode = true;
webview.Settings.UseWideViewPort = true;
//webview.Settings.SetSupportZoom (true);
webview.Settings.SetPluginState (WebSettings.PluginState.On);
webview.Settings.GetPluginState ();
if (externalUrl.StartsWith("http://") || externalUrl.StartsWith("https://"))
webview.LoadUrl (externalUrl);
webview.SetWebViewClient (new MonkeyWebViewClient (imgViewBack, imgViewForward, imgRefresh));
webview.SetWebChromeClient (new WebChromeClient ());
}
Run Code Online (Sandbox Code Playgroud) 我的布局的一个片段:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:text="@string/moreInfo"
android:layout_width="wrap_content"
android:layout_weight= "1"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:id="@+id/moreInfo" />
Run Code Online (Sandbox Code Playgroud)
我收到一个 IntelliSense 错误:必须为文件中的每个 android:layout_weight 实例指定一个单位,例如“px”。我已经尝试将 WeightSum 添加到 LinearLayout 并从 int 更改为 float (尽管仍然在引号中),但错误仍然存在。
奇怪的是(至少对我而言)我仍然可以在模拟器上构建/运行我的代码。我的猜测是它是 IntelliSense 中的东西,我不喜欢明显的错误,即使它们是错误的......
使用 VS2019 社区。
我喜欢Monocross的想法,但是当我想使用Panorama和/或Pivot控件时,我对Windows Phone 7有点失落.提供的唯一视图是页面视图.因此,从一个页面导航到另一个页面非常有用!但现在我想要一个Pivot或Panorama.基本上我可以为这个视图创建一个新的控制器,但确实得到了控件内的"页面".导航确实导航到它,但不在数据透视/全景内.
对于Monotouch和MonoDroid样本已经准备好了如何做到这一点(基本上创建了一个新的viewcontroller).但WP7已被抛在后面.
任何人?