开发者

Programmatically set layout for android

开发者 https://www.devze.com 2023-01-01 08:27 出处:网络
I am trying to improve the layout for my game.The problem is that while I can create a good layout for one android phone, it doesn\'t work for another, ie the track开发者_Python百科ball for MyTouch

I am trying to improve the layout for my game. The problem is that while I can create a

good layout for one android phone, it doesn't work for another, ie the track开发者_Python百科ball for MyTouch

is on the right side (landscape mode), but for the MyCliq, the DPad is on the left side. Is

there a way to programmatically set the layout based on which phone it is? Thanks.


While not being programmatic, nor phone specific, you can supply alternative layout resources that are automatically loaded depend on whether the devide has a DPad or a trackball.


If you really wanted to do it on a device specific basis, perhaps android.os.Build.DEVICE would help.

http://developer.android.com/reference/android/os/Build.html#DEVICE

I haven't tried it but perhaps it will help

0

精彩评论

暂无评论...
验证码 换一张
取 消