【问题标题】:Appcelerator titanium TableView with Android 4.x zoomed outAppcelerator Titan TableView 与 Android 4.x 缩小
【发布时间】:2012-04-20 14:18:09
【问题描述】:

我正在研究 appcelerator 钛。在我在 KitchenSink 中复制几乎相同的代码来执行 tableview 之后,当我在我的设备中显示它时,我最终得到了一个缩小的 TableView(Galaxy Nexus 上的 android 4)。缩小意味着字体和图像非常小。奇怪的是:1-它在 android 模拟器中显示得恰到好处 2-它在我的 android 设备中显示得恰到好处,但使用的是 KitchenSink 可能是什么问题? 这是该部分的代码:

    if (Ti.Platform.name == 'android') 
{
    Titanium.UI.currentWindow.backgroundColor = '#4e5c4d';
}
else
{
    Titanium.UI.currentWindow.backgroundColor = '#aebcad';
}

// create table view data object
var data = [

    {title:'Table View (Layout 2)', hasChild:true, test:'../main_windows/profile.js'}
];


// create table view
var tableViewOptions = {
        data:data,
        style:Titanium.UI.iPhone.TableViewStyle.GROUPED,
        headerTitle:'TableView examples and test cases',
        footerTitle:"Wow. That was cool!",
        backgroundColor:'transparent',
        rowBackgroundColor:'white'

    };


var tableview = Titanium.UI.createTableView(tableViewOptions);

// create table view event listener
tableview.addEventListener('click', function(e)
{
    if (e.rowData.test)
    {
        var win = Titanium.UI.createWindow({
            url:e.rowData.test,
            title:e.rowData.title
        });
        Titanium.UI.currentTab.open(win,{animated:true});
    }
});

// add table view to the window
Titanium.UI.currentWindow.add(tableview);

【问题讨论】:

    标签: titanium tableview appcelerator android-4.0-ice-cream-sandwich


    【解决方案1】:

    已解决:

    我不得不更改 tiapp.xml 文件并添加以下行:

        <supports-screens android:anyDensity="false"/>
    

    在 android mainfest 部分 现在是这样:

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

    【讨论】:

      【解决方案2】:

      您应该小心,因为 google 的建议是仅将其用于 Android 1.4 及更低版本。 更好的解决方案是创建适合屏幕尺寸的图像。

      http://developer.android.com/guide/topics/manifest/supports-screens-element.html#any

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-11-10
        • 2011-11-20
        • 2011-07-03
        • 1970-01-01
        • 2011-06-30
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多