Android Layout qualifiers don't work? - android

I am developing an android using the API Google Tv Addon, i wanna use the screen qualifiers no touch, i created a folder under /res/ called layout-notouch, i named my layout test.xml, in my activity when i put setContentView(R.layout.test) the application crash. how could i use this screen qualifier. Or otherwise, could i set qualifiers programatically. you can take a look here enter link description here

You can use layout-large-notouch for layout and drawable-land-xhdpi for drawables to target Google TV.

I figured out that the layout-notouch is not working.You can find the google bug report at this links https://code.google.com/p/android/issues/detail?id=20087
Some people are suggesting to use resource qualifiers layout-tvdpi-notouch (720) & layout-xhdpi-notouch (1080),layout-large-notouch.
But not sure the suggestion is working.

I'm not entirely sure about what I'm about to say, but it seems to me that "notouch" qualifiers will not work because current Google-TVs support some sort of touch. You have a trackpad that acts as a mouse and you can click on things, simulating "touch" events.
If in the GTV emulator you edit the avd settings, you can specifically declare the "touch screen type" as "notouch". Then, if you run your application under those conditions you will see that the "notouch" qualifiers work. This means that by default "touch-screen type" is set to "touch" instead of "notouch".

Related

How to change system view icons/style, functionality on android?

How to change view and functionality of multiwindow form(picture 1) like that done samsung(picture 2)?
Do we need a launcher (just a specific system change) or do we need to compile a new ROM (if ROM, then where do we need to change the code and view)?
I tried to find a section of the system where the design and window functions are regulated in the multiwindow / freeform mode, but it did not work out. How do you think what part of the code is responsible for the style and elements of this "app header" (panel with button close and others)?
Take a look at Android Runtime Resource Overlay (aka RRO).

Is there a quick and easy way to preview a layout at different screen sizes?

Is there a quick and easy way to see how my application will look on different screen sizes and shapes? Currently, I'm going into the AVD manager, editing my device definition, and then launching a fresh emulator. It takes maybe ten minutes for each one.
They layout is defined entirely from resource files. I don't actually need to execute the app. Is there a faster way to do this?
Edit: I should add: there are some custom widgets in the app.
While looking at a layout open the "Design" tab or open the "Preview" tab on the side. On the top of the window you will see a list where you can change the layout and orientation.
May not solve your entire issue, but it's a good to know.
If you want to have a preview of a static page (not rendered at runtime, like recyclerview), you could use android studio to do that.

Android Different Menu Resources

Doe's Android support multiple menu folder (e.g. like /drawable-hdpi and /drawable-mdpi)? If so what types are supported (land, xhdpi, swXXXdp)?
P.S. Sorry for such a goofy question...
Edit 1: For example I have different layouts. Depending on that I can have different menu resources, no? As a start it would be nice to have sooch folders:
res/menu
res/menu-land
res/menu-xhdpi
res/menu-xhdpi-land
res/menu-sw600dp
The first two work fine... but when I try to add the other ones the app work instable on different devices.
Yes. even in portrait and landscape modus:
menu-land-mdpi
menu-port-mdpi
menu-land-hdpi
menu-port-hdpi
menu-land-xhdpi
menu-port-xhdpi
yes. Don't see any point not to support it, documentation here provides no restrictions on it (I myself at least have used -land qualifier)
The menu can be used like layout folder, you can add menu-land, menu-port ... also, you can use specific menu for multi langue, like menu-fr, menu-en to rearrange items based on phone language...

Universal App for both tablets+handsets

I am developing a single application for both tablets and for handsets..My app is currently running fine on handsets(as according to layouts and all)..but i have no idea for how to distinguish it for handsets/tablets. I have seen some of the answers in Stackoverflow.com too, in which some people answered that use different layout-large,layout-xlarge.
but if the layout differs and we follow the above scenario,then in programming,it is written setcontentView(R.layout.---).
So we have to mention here also that setContentView(R.layout-large.---)..I am so confused with this..Can anyone suggest me something...
you only need to name the folder differently those contain same nameLayout.xml
like so
--layout
-- myLayout.xml
--layout-large
-- myLayout.xml
--layout-xlarge
-- myLayout.xml
on code, you only need to use
secContentView(R.layout.myLayout);
android will find the right one for you.
The android os will select the appropriate folder based on the device dimensions and other properties.
So you can keep the resource name same in all the folders and android will pick from the appropriate folder.

Open source versions of Android phone icons

Are there open source versions of the standard Options, Home, Back, and Search icons that appear on every phone?
Check out this page, it offers a convenient way to browse the built-in drawables, most of which you can use just by referencing them in your layout.
See for example, the item ic_menu_home. You can probably use it in a layout like so
<android:Whatever
android:icon="#drawable/android:ic_menu_home"/>
Although, as the author of the page mentions, you sometimes have to copy items from the SDK resources folder if the above method throws an error.
Note also that while this method isn't guaranteed to match the icon you see, it will match what the user will see for that logical name. For example, I used this technique to add the "Preferences" icon to an options menu, and the emulator had a different icon than what was shown there. When you want a "standard" icon, this is good, although if you really wanted an exact image you could copy it into your app's res folder.

Categories

Resources