screen-size

Android: Restrict activity orientation based on screen size

一世执手 提交于 2019-12-07 17:24:54
问题 I have an app that looks good in either orientation on a large or xlarge screen size, but should be restricted to portrait on phones. I know that you can restrict the orientation of an Activity in the manifest, but is there a way to do so conditionally? Or is there some kind of property I can set in the activity itself to choose which orientations are supported? 回答1: This is the solution I use in my apps: public void onCreate(Bundle savedState) { //... if(isScreenLarge()) { // width > height,

Make text fit exactly as the screen size

≯℡__Kan透↙ 提交于 2019-12-07 14:45:37
问题 I have a long text so I've decided to divide it into pages, and I put a so each swipe scrolls to the next page.. The way I did it was: NumberOfPages=text.length()/CharPerPage; //CharPerPage=500; NumberOfPages++; Chapters.add(text.indexOf(" ", CurrentPage*CharPerPage)); CurrentPage++; int tmp=0; for(int i =NumberOfPages;i>0;i--) { tmp =(CurrentPage*CharPerPage); if(tmp>text.length()) { Chapters.add(text.length()); break; } else { Chapters.add(text.indexOf(" ", tmp)); CurrentPage++; } } So I

Android app on Google Play Store is not compatible with LG G3 (Density 538, Size 2560x1440)?

旧街凉风 提交于 2019-12-07 14:10:24
问题 Android App is not compatible with LG G3 device which has high resolution and density. I have already test following config in manifest, neither support-screens nor compatible-screens nor both does not work. <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" /> <compatible-screens> <!-- all small size screens --> <screen android:screenDensity="ldpi" android:screenSize="small" /> <screen

Butterknife with Different Layouts for Phones and Tablets

冷暖自知 提交于 2019-12-06 07:31:16
问题 I am having a bit of an issue with using the Butterknife library in my current project. I am currently optimizing the project for both phones and tablets and there are sometimes slight differences between the layout files for the two for example layout/layout_example.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/text1" android

Adb shell getevent method returns twice the value for X and Y on Nexus 4

佐手、 提交于 2019-12-06 06:36:59
问题 I am currently trying to generate a complex gesture via the sendevent command of adb shell. In order to replay a gesture, I recorded the events via the getevent method of adb. Here is a sample of a simple tap on the bottom right of my Nexus 4 screen. /dev/input/event2: 0003 0039 00000059 /dev/input/event2: 0003 0035 000005ff /dev/input/event2: 0003 0036 000008e6 /dev/input/event2: 0003 003a 0000002d /dev/input/event2: 0000 0000 00000000 /dev/input/event2: 0003 0039 ffffffff /dev/input/event2:

Android compatibilty settings in AndroidManifest.xml

╄→гoц情女王★ 提交于 2019-12-06 05:00:35
问题 I have an app to release which works on all android screen-sizes (except smaller) and densities above SDK version 2.0. It will also run on extra large screens. Currently I have added this: <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="false" android:anyDensity="true" /> But I also need to add android:xlargeScreens="true" , to allow it visible in android market on extra large screen devices, since by default it is false. But to add android

How do I find the display size of my system in Emacs?

孤街醉人 提交于 2019-12-06 04:19:51
问题 I use the same .emacs across multiple machines, operating systems and platforms. I would like the default frame size of Emacs upon invocation to be relative to the available screen size (e.g. 96 lines work very well on a 1600x1200 desktop screen, but on an 1280x800 laptop I need to specify no more than 68 lines). Is there an emacs-lisp expression that returns the width & height of the system's screen? Update: I just found a similar question, but for some reason neither (x-display-pixel-width)

CSS: How to set the width and height dependent on the screen/window size?

喜夏-厌秋 提交于 2019-12-06 03:43:09
问题 Following up this question here I am trying to get a good rendering of a floating 3D cube using three.js. The camera proportions are window.innerWidth / window.innerHeight and since I am using a rectangular div container, I get a flattened cube. Something like this. I tried to get my div container to be in proportion with my screen or window size and it worked! For example for a 1367x768 screen: CSS: #render { width: 450px; height: 250px; } But! I want to have this worked out also for

Android: Restrict activity orientation based on screen size

孤者浪人 提交于 2019-12-05 21:30:31
I have an app that looks good in either orientation on a large or xlarge screen size, but should be restricted to portrait on phones. I know that you can restrict the orientation of an Activity in the manifest, but is there a way to do so conditionally? Or is there some kind of property I can set in the activity itself to choose which orientations are supported? This is the solution I use in my apps: public void onCreate(Bundle savedState) { //... if(isScreenLarge()) { // width > height, better to use Landscape setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else {

On iPhone5 [[UISCreen mainScreen] bounds].size comes back as 320x480?

▼魔方 西西 提交于 2019-12-05 21:11:59
问题 On iPhone5 [[UISCreen mainScreen] bounds].size comes back as 320x480. Why. In all the posts I'm reading, people are saying that it returns the correct screen size. What is going on here? Am I missing something in the .plist file or something? BTW I am hand coding the GUI, so there is no XIB. 回答1: Unless your app includes a Default-568h.png in it's bundle, it will run inside a 480 point high legacy screen sandbox on the iPhone 5, and can't draw or see any dimensions outside that sandbox. Note