screen

Turn off/on android screen

*爱你&永不变心* 提交于 2019-12-25 17:35:17
问题 I am trying to turn the android screen off and then on again, after a few seconds. The "turn off" part works, with this code: WindowManager.LayoutParams layoutParam = getWindow().getAttributes(); oldBrightness = android.provider.Settings.System.getInt(getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS)/255f; layoutParam.screenBrightness = 0; layoutParam.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; getWindow().setAttributes(layoutParam); But then, when I try

Calculate screen size in android

社会主义新天地 提交于 2019-12-25 15:19:23
问题 I have traveled all over the internet looking for a way to do something that I thought would be very basic. Bottom line is: I have an android UI that I have designed. It consists of buttons that are placed along the middle of the screen. This is sort of a menu screen. These buttons need to be in the SAME location but should just increase or decrease in size in relation to the physical size of the screen. Basically, if i have a button on a screen that is 1px (or dip; dip is what i currently

Calculate screen size in android

雨燕双飞 提交于 2019-12-25 15:17:27
问题 I have traveled all over the internet looking for a way to do something that I thought would be very basic. Bottom line is: I have an android UI that I have designed. It consists of buttons that are placed along the middle of the screen. This is sort of a menu screen. These buttons need to be in the SAME location but should just increase or decrease in size in relation to the physical size of the screen. Basically, if i have a button on a screen that is 1px (or dip; dip is what i currently

How to stop a background thread when the screen in android device goes off

限于喜欢 提交于 2019-12-25 08:49:39
问题 I have a background thread in my app. Now when the screen goes off(after say 15 seconds), the thread is running and hence does not behave as I prefer. So, in which method of the Activity life cycle do I have to stop the thread when the screen goes off. I know how to stop the thread but do not know when to stop it. Thanks in advance. 回答1: Do you want it to run when the app is in the background (if the user is in another app)? If not, onPause. If so, then you'd need a BroadcastReceiver to

Java - Libgdx : Keep actor's position even screen's resolution changes

♀尐吖头ヾ 提交于 2019-12-25 08:09:13
问题 issue is next one: my game is built for 1080x1920 pixels screen but if I run it in other resolutions my actors' position is switching. Some pictures if you haven't understood: ~> original resolution ~> other resolution I looked for an answer for days in Google, Stackoverflow, forums, couldn't find the right answer for my problem, here's my code: public class PlayScreen implements Screen { private Main game; private Stage stage; Music music; Sound sound; private class MenuGame extends Actor {

IE7 on XP render the media=“print” stylesheets

走远了吗. 提交于 2019-12-25 07:16:25
问题 In my web page, I'm using 2 stylesheets : <link rel="stylesheet" href="css/screen-layout.css" media="screen" type="text/css" /> <link rel="stylesheet" href="css/print-layout.css" media="print" type="text/css" /> inside print-layout.css there is : .ui-dialog * {display: none !important;} When I viewed my webpage on IE7, it's supposed to ignore the media="print" one, but it didn't, it applied the display: none , causing all the elements to be hidden. And in the debugbar plugin for IE7, I can

How can i enable pinching and stretching on my app's UI

房东的猫 提交于 2019-12-25 06:55:28
问题 I've a table layout with a textview in it. As the texts within every row are small enough to fit into the screen, I want my users to be able to pinch and stretch the screen so that they can zoom in. But, currently that feature is not working by default. How can i enable pinching and stretching the screen, then? Thanks 回答1: You can implement it yourself. Start by reading this multipart tutorial: http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2/1747 (part 6 is devoted to

Android: How to change divide the screen in 3 equal buttons

孤街醉人 提交于 2019-12-25 03:49:08
问题 I have 3 buttons in a layout. What I want to do is increase the size of the buttons so they fill the entire screen. How can I do that in the xml file? 回答1: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="3"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" android:layout_weight="1"/> <Button android:layout_width="fill

Turn the screen in to totally dark when press the button on the screen

本秂侑毒 提交于 2019-12-25 02:46:44
问题 How to code the android to turn the screen completely off just like you press the power button to lock your screen. I want the user to press the button on the screen and then screen goes off. I have tried (with permission): PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "tag"); wl.acquire(); but not working for me, please help! thank you! 来源: https://stackoverflow.com/questions/23432552/turn-the-screen-in-to-totally-dark

Overlap background (and overlap image) on Nexus 5

℡╲_俬逩灬. 提交于 2019-12-25 01:55:27
问题 This is the Overlap Background (or Overlap Image) problem which I only get it on Nexus 5 Emulator while testing. I have not tested on Nexus 5 Device, but I think the Emulator should show quite correct. This is my coding indicated how to support multiple screen, it works for the others device, not for Nexus 5 emulator . Followed the answer in here also but it not works. In my application, I used Fragment to transfer among pages . It happened when I transfer from first page (red words in image)