0

I am working on appcelerator titanium. After I copied almost the same code in KitchenSink to do a tableview, I ended up with a zoomed out TableView when i display it in my device ( android 4 on Galaxy Nexus ). Zoomed out means font and images are really small. What's weird is: 1- it displayed just right in the android emulator 2- it displayed just right in my android device but using KitchenSink What can be the problem ? here is the code for that part:

    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);
AlAsiri
  • 717
  • 7
  • 19

2 Answers2

1

SOLVED:

I had to change the tiapp.xml file and add the line:

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

in the android mainfest section so it is now:

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

        </manifest>

</android>
AlAsiri
  • 717
  • 7
  • 19
0

You should watch out because googles advice is to use this only for Android 1.4 and lower. The better solution would be to create images which fits the screen size.

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

fklappan
  • 3,259
  • 2
  • 17
  • 18