【问题标题】:Best practices for image res / pixel size in hybrid mobile apps for ios and android?ios 和 android 混合移动应用程序中图像分辨率/像素大小的最佳实践?
【发布时间】:2016-08-11 05:41:00
【问题描述】:

对于 ios 和 android 的混合(Ionic 和 React Native)应用程序中的全屏图像的图像分辨率/像素大小的最佳做法是什么?你如何处理不同的屏幕尺寸?您是否像为 Web 所做的那样为不同的屏幕制作不同的图像?还是您使用一种图像尺寸,然后您如何处理随之而来的问题?您使用的像素大小是多少?

谢谢。

【问题讨论】:

  • 你的意思是为不同的设备调整图像?
  • 你好 Sa E,没错。
  • 如果这是您的要求,您可以通过读取设备屏幕宽度并调整我们的图像 div 的指令来细香葱

标签: angularjs cordova ionic-framework


【解决方案1】:

通过这个指令,我克服了 Tinder 个人资料类应用程序中的图像拉伸问题

app.directive('resize', function ($window) {

    return function (scope, element) {
        var w = angular.element($window);
        scope.getWindowDimensions = function () {
            return { 'h': w.height(), 'w': w.width() };
        };
        scope.$watch(scope.getWindowDimensions, function (newValue, oldValue) {

            scope.windowHeight = newValue.h;
            scope.windowWidth = newValue.w-30;

            scope.style = function () {
                return {
                    'height': (newValue.h - 100) + 'px',
                    'width': (newValue.w - 100) + 'px'
                };
            };

        }, true);

        w.bind('resize', function () {
            scope.$apply();
        });
    }
})

【讨论】:

    猜你喜欢
    • 2012-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多