android-screen

programmatically taking screenshot of current screen in android device?

点点圈 提交于 2021-02-18 19:05:14
问题 I am working on an app in which I have some edit texts and background image. I wrote something in that edit text, I want to save whole current screen as an image, so that I can send it via email. I got a solution using ASL(android screenshot library) but for this I have to start native service on my device every time when I reboot it. So is there any other solution to take screenshot of current screen? 回答1: Try this.. find the Parent layout in you xml and do this. LinearLayout ll =

Inverted width and height when unlocking with device rotated

允我心安 提交于 2020-01-25 09:20:29
问题 I'm getting screen size using this code: getWindowManager().getDefaultDisplay().getRealSize(size); sw = size.x; sh = size.y; I'm using it for specifying DialogFragment width and height: @Override public void onResume() { super.onResume(); int sw = Util.getInstance().getScreenWidth(getActivity()); int sh = Util.getInstance().getScreenHeight(getActivity()); getDialog().getWindow().setLayout((int)(sw*0.6), (int)(sh*0.6)); } *I need to specify the width and height of the dialog in onResume. It's

Find exact coordinates of a single Character inside a TextView

独自空忆成欢 提交于 2020-01-12 14:23:29
问题 Currently I'm using paintObject.measureText(textCopy.substring(0,i)) while iterating through a copy of the TextView's text. For example, measureText("abc".substring(0,1)) will give me the relative x coordinates of 'b'. The y coordinate I get from layout.getLineTop() . This is working but not accurate for x coordinates for non-monospaced fonts. I can calibrate a little, but on each device it works differently. The best solution I can think of is to overwrite the class that is responsible for

Android - How to dynamically change fragment layout

放肆的年华 提交于 2019-12-30 06:28:42
问题 I have a tablet app with an about fragment which displays my company's datas. I would like to change my layout dynamically with screen orientation while im on the page but i didn't found how yet. If someone got the solution, thanks in advance 回答1: @Yume177, i found how to do it : @Override public void onConfigurationChanged(Configuration newConfig) { // TODO Auto-generated method stub super.onConfigurationChanged(newConfig); RelativeLayout rl = (RelativeLayout) findViewById(R.id.about); rl

Android - How to dynamically change fragment layout

此生再无相见时 提交于 2019-12-30 06:28:27
问题 I have a tablet app with an about fragment which displays my company's datas. I would like to change my layout dynamically with screen orientation while im on the page but i didn't found how yet. If someone got the solution, thanks in advance 回答1: @Yume177, i found how to do it : @Override public void onConfigurationChanged(Configuration newConfig) { // TODO Auto-generated method stub super.onConfigurationChanged(newConfig); RelativeLayout rl = (RelativeLayout) findViewById(R.id.about); rl

Supporting multiple screen size - Android

大憨熊 提交于 2019-12-27 12:09:14
问题 I am going to develop new application in Android. This application should only work in portrait (even for tablet). Also the UI and layout design should be similar on phones and tablet. We can't change the layout design for tablet as it has huge area to use. We have to stretch all the images to match phones. We can use nine patch. But I am little bit confused of using images in multiple drawables. As per my analysis (may be wrong.. : ) ) the screens are divided into density and sizes. We can

Supporting multiple screen size - Android

好久不见. 提交于 2019-12-27 12:06:02
问题 I am going to develop new application in Android. This application should only work in portrait (even for tablet). Also the UI and layout design should be similar on phones and tablet. We can't change the layout design for tablet as it has huge area to use. We have to stretch all the images to match phones. We can use nine patch. But I am little bit confused of using images in multiple drawables. As per my analysis (may be wrong.. : ) ) the screens are divided into density and sizes. We can

Android App should visible in playstore for normal screen devices as well as tablets and should appear perfect in both (screen resolution)

回眸只為那壹抹淺笑 提交于 2019-12-24 12:02:13
问题 I have recently published android app (sdk version 4.2) in playstore. My requirement is that - this app should be visible in playstore on both - large screen devices (including Samsung Galaxy Tab 2 p3100), as well as normal screen devices. I also want my app to be displayed in devices (with version 2.2 - 4.2). This is the code snippet, I was suggested for fulfilment of my requirement. <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true"

Is there a way to get screen size in dpi

ぃ、小莉子 提交于 2019-12-24 05:29:14
问题 I'm using this: int wi=getWindowManager().getDefaultDisplay().getWidth(); to get the screen size in pixels. Is there a way to get the screen size in dpi ??? I'm doing this to select different layouts base on the screen size. 回答1: Is there a way to get the escreen size in dpi??? DisplayMetrics can tell you the screen size in pixels, plus the screen density. From there, you can calculate the screen size in dp . I'm doing this to select different layouts base on the screen size. This is

How to turn on and turn off screen with adb command? [duplicate]

元气小坏坏 提交于 2019-12-23 08:50:24
问题 This question already has answers here : Is there a way to check if Android device screen is locked via adb? (7 answers) Closed last year . I am using KEYCODE_POWER to turn on and turn off my rooted phone. The bellow command is used in both case turn on and turn off the screen. adb shell input keyevent KEYCODE_POWER However, I want to use it in separated cases: turn on and turn off. I have two functions: turn on and turn off functions. If the screen is off and I call the turn on function, it