1

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

Nathan
  • 128
  • 3
  • 12
  • 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. – Nathan May 31 '16 at 17:41
  • In the future, you should just edit additional information into your question instead of using comments. – Laurel May 31 '16 at 17:50

2 Answers2

1

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!

Amilcar Andrade
  • 1,131
  • 9
  • 16
  • Thanks for the suggestion. I tried with these folders: values-large-port, values-large-land, values-sw600dp-port, none of them worked. – Nathan May 31 '16 at 18:09
  • Weird, I just tried it and it works fine for me in using sw600 and land/port folders. – Amilcar Andrade May 31 '16 at 18:16
  • What's the exact value of your folder name? values-sw600dp-port? That's strange. I just updated with all property values of my emulator setting. I can't find anything wrong with those settings (they are all default values) – Nathan May 31 '16 at 18:36
  • 1
    I think I found the specific reason, but no answer yet. The device I created is **Nexus 7** whose size is 7.02" with xhdpi resolution. The device @prat use is **Next 7 (2012)**. The app launched as expected on **Next 7 (2012)**, but on the new **Next 7** with xhdpi density, nothing works. My guess is this specific device emulator has a bug. – Nathan May 31 '16 at 21:40
  • Mmmm, I guess you did not create the emulator correctly. I have a Nexus 7 tablet and it works fine using the sw600 and values-large-land or values-large-port. Good luck mate! – Amilcar Andrade May 31 '16 at 21:43
  • I think you are right. I recreated the emulator and this time it worked. Thanks a lot for the help. – Nathan Jun 02 '16 at 05:33
  • Sorry, dude. My reputation is too low to make my vote counts. LOL. – Nathan Jun 02 '16 at 21:17
0

enter image description here

Try adding

layout-sw600dp-land-tvdpi

layout-sw600dp-port-tvdpi

prat
  • 597
  • 8
  • 17