钛android配置OSX

时间:2013-03-24 12:40:04

标签: android configuration appcelerator-mobile

我是新手,我正在关注“Appcelerator Titanium智能手机应用程序开发手册”

现在我已经构建了所有应用程序,但是当我尝试构建android时,我得到了一个非常尴尬的结果。看图片:

enter image description here enter image description here enter image description here

我应该在配置中更改哪些内容才能正常显示?感谢

2 个答案:

答案 0 :(得分:2)

配置中没有任何改变。 您需要为不同的设备分辨率提供不同的资源(如iPhone的视网膜和非视网膜照片,Android也有不同的分辨率和大小)。看看User Interface Fundamentals的Titanium docs。另外你应该对所有尺寸(高度,宽度,顶部,左边等)使用始终'dp'(设备无关的像素)。然后,Titanium会为当前设备重新计算此大小。

Ti.UI.createView({
  height: '20 dp',
  width: '20 dp',
  left: '20 dp'
};

答案 1 :(得分:0)

在tiApp.xml文件中添加以下内容

<android xmlns:android="http://schemas.android.com/apk/res/android">
  <manifest>
   <supports-screens android:anyDensity="false"/>
  </manifest>
 </android>

这将基本上根据使用的Android设备进行扩展,因为Android设备有不同的分辨率。请参考Defaults For Android Layouts。我使用它并发现即使对于平板电脑也能使用不同的分辨率