سؤال

How do we determine what layout folder does the application originally search for?

eg.

Application searches for layout-sw600dp but uses layout-xhdpi because sw600dp is not existing.

هل كانت مفيدة؟

المحلول

The process for selecting the appropriate resources to use is outlined in the Providing Resources document in the Android Developer's guide.

  1. Eliminate resource files that contradict the device configuration.
  2. Pick the (next) highest-precedence qualifier in the list
  3. Do any of the resource directories include this qualifier?
    • If No, return to step 2 and look at the next qualifier.
    • If Yes, continue to step 4.
  4. Eliminate resource directories that do not include this qualifier.
  5. Go back and repeat steps 2, 3, and 4 until only one directory remains.

In short, Android applications don't "look for" specific resource files; rather they pick the best matching resource file for a given device.

The table of qualifier precedence can be found here.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top