真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

關(guān)于android樹(shù)的信息

如何在android上打印dom樹(shù),render樹(shù),display

在做chromium的時(shí)候,我們?cè)赿ebug的時(shí)候經(jīng)常使用dumprendertree去打印網(wǎng)頁(yè)對(duì)應(yīng)的dom樹(shù)等內(nèi)容。

創(chuàng)新互聯(lián)從2013年開(kāi)始,先為威縣等服務(wù)建站,威縣等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢(xún)服務(wù)。為威縣企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問(wèn)題。

但是在剛接觸android的時(shí)候,一直非常煩惱怎么用android自帶的browser去打印出來(lái)這些內(nèi)容。

幸好的是,framework里面提供了一些接口,讓我們可以實(shí)現(xiàn)這個(gè)功能。

于是,寫(xiě)了個(gè)新的feature,在android的browser里面,按下menu鍵,就會(huì)增加三個(gè)新的選項(xiàng)。點(diǎn)擊響應(yīng)的選項(xiàng),就會(huì)打印出來(lái)相對(duì)應(yīng)的tree.

廢話(huà)不多說(shuō),直接貼code。

在browser的app中做下列修改:

diff --git a/res/menu/browser.xml b/res/menu/browser.xml

index 49fc4a4..08a240f 100644

--- a/res/menu/browser.xml

+++ b/res/menu/browser.xml

@@ -80,6 +80,18 @@

item

android:id="@+id/save_snapshot_menu_id"

android:title="@string/menu_save_snapshot" /

+ !--Add print_dom_tree by chao S --

+ item

+ android:id="@+id/print_dom_tree"

+ android:title="@string/dom_tree_title" /

+ item

+ android:id="@+id/print_render_tree"

+ android:title="@string/render_tree_title" /

+ item

+ android:id="@+id/print_display_tree"

+ android:title="@string/display_tree_title" /

+

+ !--Add print_dom_tree by chao E --

/group

group

android:id="@+id/SNAPSHOT_MENU"

diff --git a/res/values/strings.xml b/res/values/strings.xml

index 870d0c7..c5dbf50 100644

--- a/res/values/strings.xml

+++ b/res/values/strings.xml

@@ -908,7 +908,11 @@

!-- The description of the suggestion that lets the user search the web for the query currently

in the text field. --

string name="search_the_web"Search the web/string

-

+ !-- Add print_dom_tree by chao S --

+ string name="dom_tree_title"Print Dom tree/string

+ string name="render_tree_title"Print render tree/string

+ string name="display_tree_title"Print display tree/string

+ !-- Add print_dom_tree by chao E --

!-- HTML5 dialogs --

!-- Used as a status bar notification when the browser is running out of space trying to allocate or increase the database quota for an HTML5 databae or application cache. --

string name="webstorage_outofspace_notification_title"Browser storage full/string

diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java

index 358e746..ac3d813 100644

--- a/src/com/android/browser/Controller.java

+++ b/src/com/android/browser/Controller.java

@@ -1967,6 +1967,23 @@ public class Controller extends FjController

if (source == null) break;

new SaveSnapshotTask(source).execute();

break;

+ // -- Add print_dom_tree by chao

+ case R.id.print_dom_tree:

+ final Tab dom = getTabControl().getCurrentTab();

+ dom.getWebViewClassic().dumpDomTree(true);

+ break;

+

+ case R.id.print_render_tree:

+ final Tab render = getTabControl().getCurrentTab();

+ render.getWebViewClassic().dumpRenderTree(true);

+ break;

+

+ case R.id.print_display_tree:

+ final Tab display = getTabControl().getCurrentTab();

+ display.getWebViewClassic().dumpDisplayTree();

+ break;

+

+ // Add print_dom_tree by chao --

case R.id.page_info_menu_id:

showPageInfo();

在framework中做下列修改:

diff --git a/core/java/android/webkit/WebViewClassic.java b/core/java/android/webkit/WebViewClassic.java

index 4bfce04..d6c7cf3 100755

--- a/core/java/android/webkit/WebViewClassic.java

+++ b/core/java/android/webkit/WebViewClassic.java

@@ -5339,7 +5339,10 @@ public final class WebViewClassic extends FjWebViewClassic

* debug only

*/

public void dumpDomTree(boolean toFile) {

- mWebViewCore.sendMessage(EventHub.DUMP_DOMTREE, toFile ? 1 : 0, 0);

+ // -- Add print_dom_tree by chao

+ //mWebViewCore.sendMessage(EventHub.DUMP_DOMTREE, toFile ? 1 : 0, 0);

+ mWebViewCore.sendMessage(EventHub.DUMP_DOMTREE, toFile ? 1 : 1, 0);

+ // Add print_dom_tree by chao --

}

/**

@@ -5349,7 +5352,10 @@ public final class WebViewClassic extends FjWebViewClassic

* debug only

*/

public void dumpRenderTree(boolean toFile) {

- mWebViewCore.sendMessage(EventHub.DUMP_RENDERTREE, toFile ? 1 : 0, 0);

+ // -- Add print_dom_tree by chao

+ // mWebViewCore.sendMessage(EventHub.DUMP_RENDERTREE, toFile ? 1 : 0, 0);

+ mWebViewCore.sendMessage(EventHub.DUMP_RENDERTREE, toFile ? 1 : 1, 0);

+ // Add print_dom_tree by chao --

}

/**

extern/webkit中的修改如下:

diff --git a/Source/WebKit/android/AndroidLog.h b/Source/WebKit/android/AndroidLog.h

index f034d35..2efab96 100644

--- a/Source/WebKit/android/AndroidLog.h

+++ b/Source/WebKit/android/AndroidLog.h

@@ -37,12 +37,18 @@

#ifdef ANDROID_DOM_LOGGING

#include stdio.h

extern FILE* gDomTreeFile;

-#define DOM_TREE_LOG_FILE "/sdcard/domTree.txt"

+// -- Add print_dom_tree by chao

+// #define DOM_TREE_LOG_FILE "/sdcard/domTree.txt"

+#define DOM_TREE_LOG_FILE "/data/local/domTree.txt"

+// Add print_dom_tree by chao --

#define DUMP_DOM_LOGD(...) { if (gDomTreeFile) \

fprintf(gDomTreeFile, __VA_ARGS__); else ALOGD(__VA_ARGS__); }

extern FILE* gRenderTreeFile;

-#define RENDER_TREE_LOG_FILE "/sdcard/renderTree.txt"

+// -- Add print_dom_tree by chao

+// #define RENDER_TREE_LOG_FILE "/sdcard/renderTree.txt"

+#define RENDER_TREE_LOG_FILE "/data/local/renderTree.txt"

+// Add print_dom_tree by chao --

#define DUMP_RENDER_LOGD(...) { if (gRenderTreeFile) \

fprintf(gRenderTreeFile, __VA_ARGS__); else ALOGD(__VA_ARGS__); }

#else

@@ -50,8 +56,12 @@ extern FILE* gRenderTreeFile;

#define DUMP_RENDER_LOGD(...) ((void)0)

#endif /* ANDROID_DOM_LOGGING */

-#define DISPLAY_TREE_LOG_FILE "/sdcard/displayTree.txt"

-#define LAYERS_TREE_LOG_FILE "/sdcard/layersTree.plist"

+// -- Add print_dom_tree by chao

+//#define DISPLAY_TREE_LOG_FILE "/sdcard/displayTree.txt"

+//#define LAYERS_TREE_LOG_FILE "/sdcard/layersTree.plist"

+#define DISPLAY_TREE_LOG_FILE "/data/local/displayTree.txt"

+#define LAYERS_TREE_LOG_FILE "/data/local/layersTree.plist"

+// Add print_dom_tree by chao --

#define FLOAT_RECT_FORMAT "[x=%.2f,y=%.2f,w=%.2f,h=%.2f]"

#define FLOAT_RECT_ARGS(fr) fr.x(), fr.y(), fr.width(), fr.height()

本文為極度寒冰原創(chuàng)

Android RecyclerView 效果之樹(shù)形折疊效果

項(xiàng)目中遇到類(lèi)似,省/市/縣/鄉(xiāng)/村 這種多層級(jí)數(shù)據(jù)展示的效果.原先處理過(guò)兩層或者多層數(shù)據(jù)嵌套展示,沒(méi)有處理過(guò)這種多層數(shù)據(jù)嵌套展示的效果所以在此記錄一下,增強(qiáng)點(diǎn)記憶.

2.1 DemoTreeAdapter.class

2.2 adapter子條目的布局

2.3 holder類(lèi)

這里簡(jiǎn)單的運(yùn)用RecyclerView 實(shí)現(xiàn)了簡(jiǎn)單的樹(shù)形結(jié)構(gòu)以及處理了經(jīng)常遇到的問(wèn)題,一般需求能滿(mǎn)足,要是復(fù)雜頁(yè)面需要定制處理

看都看了點(diǎn)個(gè)贊再走吧

android 樹(shù)形ListView 控件怎么做

這個(gè)嘛,你可以這么實(shí)現(xiàn),,用SimpleExpandableListAdapte...那里還要自己拼裝組件哦.. 好麻煩的.


當(dāng)前標(biāo)題:關(guān)于android樹(shù)的信息
本文地址:http://weahome.cn/article/dsddjss.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部