增大view的有效區域

2021-06-21 04:08:33 字數 1225 閱讀 4111

android提供了乙個touchdelegate類去讓父類擴充套件它的子view的觸控區域。當子view很小但需要大的觸控區域的時候,這個類大有用處。如果你想要的話,你也能用這個類去縮小子view的觸控區域。

在下面的例子中,有乙個作為例子的imagebutton(也就是說父類會擴充套件這個子view的觸控區域)

在下面的例子中,有乙個作為例子的imagebutton(也就是說父類會擴充套件這個子view的觸控區域)

下面的**段會完成下面的事情:

imagebutton子view的觸控範圍容量內,父view會接收所有的touch events,如果touch event發生在子類的hit rectangle內,父類會將touch event傳給子類做處理。

public class mainactivity extends activity 

});// imagebutton的hit rectangle

mybutton.gethitrect(delegatearea);

// 在imagebutton邊框的右邊和底邊擴充套件觸控區域

delegatearea.right += 100;

delegatearea.bottom += 100;

// 初始化touchdelegate.

// "delegatearea" is the bounds in local coordinates of

// "mybutton" is the child view that should receive motion

// events.

touchdelegate touchdelegate = new touchdelegate(delegatearea,

mybutton);

// sets the touchdelegate on the parent view, such that touches

// within the touch delegate bounds are routed to the child.

if (view.class.isinstance(mybutton.getparent()))

}});

}}

提取遙感影像有效區域

利用某些演算法處理遙感影像時,需要排除無效區域,因此找出有效區域範圍變的至關重要,下面根據我的經驗談談有效區域提取的具體方法及實現。由於遙感影像資料量比較大,因此為了提高處理效率,提取有效區域需要在金字塔圖層進行。金字塔的建立可以利用gdal進行,也可以自己進行縮放。為了提取有效區域,我研究了兩種方...

EXCEL中使用VBA取有效使用區域

原創 牛超 2009 06 osaka 如題,修改原來的指令碼,引用usedrange private sub fillvalueauto astr as string,currow as long dim svalue as string dim sbatname as string dim sp...

var log messages迅速增大的問題

近期阿里雲磁碟總在報警,使用df和du逐一排查,發現問題出在 var log messages 每天都在迅速增加,而且此日誌跟我springboot指定的日誌完全一致。解決步驟 1 檢查springboot的logback設定。未找到將log寫到 linux syslog的相關配置。2 檢視系統日誌...