Search code examples
androidandroid-layoutnexus-7

Nexus 7 Layout Size (Nexus 7 7.02")


I'm learning Android development and tried several simple apps using Android Studio. One issue I couldn't figure out is about the Nexus 7 screen (layout) size.

Here is what I did:

  1. Use Andriod Studio (latest version: 2.1.1) to create a new project with one empty activity. Didn't change anything and run it on Nexus 7 API 19 (4.4) emulator. The app launched with the default 'Hello, world!' message.

  2. I changed res/values/strings.xml like this:

<resources>
<string name="app_name">Sample Layout Size (Default)</string>  
</resources>

When app launch, the screen is displayed like this: screen shot on Nexus 7

  1. I created new folder res/values-large, and created new strings.xml file under it. The content of strings.xml is:

<resources>
<string name="app_name">Sample Layout Size (Large)</string>
</resources>

I'm expecting when app launch on Nexus 7, the application title will change to Sample Layout Size (Large). However, it did not. It still display app title as Sample Layout Size (Default).

I created another virtual device Nexus 7 API 23 and launched the app on it, same result.

I launched the app again on Nexus 9 API 23 and this time the title changed to Sample Layout Size (Large).

I also created another folder, res/values-sw600dp, and with a new strings.xml under this dir, specifying app name to be Sample Layout Size (SW 600DP). Not working. Still same result using default value: Sample Layout Size (Default) title.

So it appears to me Nexus 7 is still using default layout. I've read several posts on Stack Overflow regarding Nexus 7 and none of them has the same issue like mine.

I understand this Nexus 7 is an old device so I'm wondering if multi-screen support has changed to handle such devices.

The following is the property of the Nexus 7 emulator:

Name: Nexus_7_API_23
CPU/ABI: Google APIs Intel Atom (x86)
Path: C:\Users\Nathan\\.android\avd\Nexus_7_API_23.avd
Target: google_apis [Google APIs] (API level 23)
Skin: nexus_7_2013
SD Card: 100M
hw.dPad: no
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: Nexus 7 2013
vm.heapSize: 64
hw.device.manufacturer: Google
hw.gps: yes
image.androidVersion.api: 23
hw.audioInput: yes
image.sysdir.1: system-images\android-23\google_apis\x86\
tag.id: google_apis
hw.camera.back: none
hw.mainKeys: no
AvdId: Nexus_7_API_23
hw.camera.front: none
hw.lcd.density: 320
runtime.scalefactor: auto
avd.ini.displayname: Nexus 7 API 23
hw.gpu.mode: auto
hw.device.hash2: MD5:47dc70fd92541dd16c19f9efa3e9db62
hw.ramSize: 1536
hw.trackBall: no
hw.battery: yes
hw.sdCard: yes
tag.display: Google APIs
runtime.network.latency: none
hw.keyboard: yes
hw.sensors.proximity: no
disk.dataPartition.size: 800M
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes

Attached is the configuration for the troubled device. avd config


Solution

  • I think they recommend to use sw600dp now but if that does not work you can create values-large-port and values-large-land folders. Hope this help!