使用OnTouchListener 通过对象,我想显示在imageview(源图像视图)上填充的位图的一部分.
所以这不是问题,我这样做:
Bitmap bt = Bitmap.createBitmap(sourceBitmap,event.getX(),event.getY(),250,250);
其中:
结果是:
所以出现的问题,当我的对象(touchlistener),去边境(我有此可能性橙色物体,去了边框与Object.width()/ 2).
所以在这种情况下:

我怎样才能达到这个结果:

部分的结果将是:
我现在尝试的是:
public boolean onTouch(View view, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_MOVE:
//i want to draw bigger portion then corrds
int CurrentX = (int)view.getX() - (view.getWidth());
int CurrentY = (int)view.getY() - (view.getHeight());
//case,when object is going out of …Run Code Online (Sandbox Code Playgroud) 我正在使用Db(通过SQLite.NET PCL,而不是异步版本).在目前我有一个列表视图与一些数据(取自数据库),我也有一个搜索栏/条目(其nvm),用户可以输入一些值然后,通过LINQ我将进行查询并更新SourceItems我的清单.
所以问题来自于性能,因为我的数据库有百万条记录和简单的LINQ查询工作非常慢.换句话说,当用户输入的数据太快时,应用程序会有很大的滞后,有时会崩溃.
为了解决这个问题,我想到了一些事情(理论上的解决方案):
1)需要在任务上放置方法(我对db进行查询)(解锁我的主UI线程)
2)初始化计时器,然后打开并:
类似的东西(类似)或任何建议.谢谢!
UPD:
说实话,我尝试了太多并没有得到好结果
BTW,我目前的代码(片段):
1)我的SearchMethod
public void QueryToDB(string filter)
{
this.BeginRefresh ();
if (string.IsNullOrWhiteSpace (filter))
{
this.ItemsSource = SourceData.Select(x => x.name); // Source data is my default List of items
}
else
{
var t = App.DB_Instance.FilterWords<Words>(filter); //FilterWords it's a method,where i make direct requests to the database
this.ItemsSource = t.Select(x => x.name);
}
this.EndRefresh …Run Code Online (Sandbox Code Playgroud) c# multithreading search-engine task-parallel-library xamarin.forms
我没有什么问题。
我得到一个图像,转换为Bitmap并用这个Bitmap填充图像视图。
所以问题是,如何获取这个位图的真实坐标(X,Y)?
为了更好地说明,我附上了一张图片:

如图所示,例如我得到了一个自定义分辨率的图像,用户可以通过黄点制作透视图。
所以我需要知道,如何从 ImageView 中获取位图的真实坐标。
我目前所做的(但这种方法不正确):
我从 imageView 中获取宽度/高度并使用此分辨率重新创建新位图。
Bitmap bt = Bitmap.CreateScaledBitmap(BitmapFactory.DecodeResource(Activity.Resources, Resource.Drawable.test),800,1420,false); //800 width 1420 height
imgView.SetImageBitmap(bt);
Run Code Online (Sandbox Code Playgroud)
通过TouchListener 的实现(方法GetX() / GetY()),我得到了点的坐标(覆盖在位图上的黄色圆圈),问题是这些坐标不正确。
当我在 imageView 上通过 ScaleType.FitXY 拉伸位图时,它对我来说也很有趣(它可以获取位图的真实坐标)?
那么我怎样才能实现我的目标呢?
我正在为我的Xamarin.iOS应用程序使用Google Maps SDK,我遇到了问题.
我想将MapView放入特定的UIView(在Storyboard上创建),这并不像预期的那么容易.
目前我已经尝试将MapView类放入我的UIView类中(在原生iOS开发中是一个解决方案),但它没有用.
我也尝试过这样的事情:
//init google SDK stuff
MyViewWhereIWantToPutGoogleMaps.AddSubview(MapView); // and the same,no effect
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢.
android ×2
bitmap ×2
xamarin ×2
xamarin.ios ×2
border ×1
c# ×1
canvas ×1
coordinates ×1
drawbitmap ×1
google-maps ×1
imageview ×1
ios ×1
uiview ×1