android-ui

Any faster way to dump UI hierarchy?

别来无恙 提交于 2021-02-17 22:23:08
问题 Right now I'm using uiautomator do dump the UI like this: adb shell uiautomator dump And it works fine except that it takes around 3 seconds to perform it. So I wonder if there is a faster way to do it? Like creating a service that dump the UI or will it take just as long? 回答1: Guess I should answer my own question as I found a better way to do it. I found this project that use uiautomator togheter with a light weight rpc server so you can send commands to the device: https://github.com

View outside a Dialogs bounds

∥☆過路亽.° 提交于 2020-11-26 03:23:35
问题 I want something like this: The users profile picture is "popping out" over the dialogs bounds. I've tried everything: messing with clipping with every possibly combination under the sun, dynamically creating the view after the dialog and adding it to the root content view, using a seperate view and loading that in with Dialog.setCustomTitle(), hacking the Images onDraw() methods and applying all-sorts of bounds/positional hacks --- but no matter what the image always gets clipped and split

View outside a Dialogs bounds

房东的猫 提交于 2020-11-26 03:22:41
问题 I want something like this: The users profile picture is "popping out" over the dialogs bounds. I've tried everything: messing with clipping with every possibly combination under the sun, dynamically creating the view after the dialog and adding it to the root content view, using a seperate view and loading that in with Dialog.setCustomTitle(), hacking the Images onDraw() methods and applying all-sorts of bounds/positional hacks --- but no matter what the image always gets clipped and split

View outside a Dialogs bounds

江枫思渺然 提交于 2020-11-26 03:21:14
问题 I want something like this: The users profile picture is "popping out" over the dialogs bounds. I've tried everything: messing with clipping with every possibly combination under the sun, dynamically creating the view after the dialog and adding it to the root content view, using a seperate view and loading that in with Dialog.setCustomTitle(), hacking the Images onDraw() methods and applying all-sorts of bounds/positional hacks --- but no matter what the image always gets clipped and split

TextView visibility change notification

十年热恋 提交于 2020-04-11 12:44:26
问题 I need to detect when a TextView is made visible and when its made invisible. Is there any way to do this in Android? I've to make some processing when a TextView in my application changes visibility. Actually, it's visibility is being updated at a number of places and I'm looking to avoid calls at all of these places. 回答1: I don't know if this will answer your question, but if you want to listen to textview visibility changes, I suggest customizing TextView and implement your own listener

assigning large string to textview.settext hangs UI

ぐ巨炮叔叔 提交于 2020-03-23 06:32:51
问题 I'm trying to show very large text (of length 850879) in textview, unfortunately when I assign text to textview, UI hangs for 8-15 seconds! How do we fix this issue? any idea? 回答1: Use Webview....instead of textview. Textview is not design to load large text. WebView webView; String html; webView.loadDataWithBaseURL("", html, "text/html", "UTF-8", ""); 回答2: Can you spilt the text in small chunks and provide it to a list view... That way ui will not be blocked for what's not visible 来源: https:

Set Link Clickable in Java-Android

旧街凉风 提交于 2020-02-27 06:21:47
问题 I am designing an App, where there is TextView, and based on some check condition, I want to make links / phone numbers in the TextView clickable in Java side. Can I do this, I don't want to make it clickable by default which is done by setting in xml file android:autoLink="all" What I already tried: Create regular TextView and don't set autoLink="all", TextView myView = (TextView)view.findViewById(R.id.thisIstheTextView); myView .setLinksClickable(true); also tried : myView

In Android, how do I position an image on top of another to look like a badge?

给你一囗甜甜゛ 提交于 2020-02-02 02:19:26
问题 Please see below: I tried using Absolute layout, but that's deprecated. I appreciate your help, thanks. 回答1: RelativeLayout is a great option. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" android:scaleType="centerCrop"

How to show icons in ActionBar overflow menu?

冷暖自知 提交于 2020-01-31 04:10:30
问题 I want to display icon in addition to menu item title in overflow dropdown menu. Is is possible? 回答1: put your menu with property android:showAsAction="always" and in xml file of menu add sub menus under that your menu like this <item android:id="@+id/mainMenu" android:icon="@drawable/launcher" android:showAsAction="always"> <menu> <item android:id="@+id/menu_logout" android:icon="@drawable/log_out" android:title="logout"/> </menu> </item> this will show the icons in menus 回答2: There is

Android ListView, with EditText ListItem move to Next

╄→гoц情女王★ 提交于 2020-01-25 10:04:28
问题 I have a ListView that has ListItem with EditText. This is to simulate a long Form. Once the user is done entering field, I want the cursor to move to next row, i.e. Next ListItem. To get the next button, in the ListItem xml, I set the ime option to next: <EditText android:id="@+id/input_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:imeOptions="actionNext"/> The form could be long with over 20 items to enter. At a given time only 7 rows are visible.