-1

幅と高さが異なる写真がたくさんあります。

100% の幅と動的な高さの画像でリストを設定したいのですが、Smartface で "adjustViewBounds" のような設定が見つかりません。

私の画像は幅が異なるため、「画像サイズプロパティ」を自動サイズ調整します。

4

2 に答える 2

0

このリストをリピート ボックスの行に使用しますか?それとも何に使用しますか? 動的に、任意のページにある画像の高さと画像の幅を設定できます。

于 2015-01-28T09:03:11.803 に答える
0

repeatbox を使用していて、画像サイズに関連する rowHeights を変更したい場合は、repeatBox の customRowHeight メソッドを使用できます。

お気に入り ;

var rBox = new SMF.UI.Repeatbox();
 // adding items to repeatbox
 /* If this property is assigned to a function, this function will be called. This function results will override any height value previously given
 * @param {number} maxRows  Required. Maximum value index of rows to be added to repeatbox
 * @param {number} minRows  Optional. Minimum value index of rows to be added to repeatbox
 * @return {object} A custom object with two key properties (activeItem , inactiveitem) which values are number arrays
  */
 rbox.customRowHeight = function (maxRows, minRows) {
    var i;
    var result = {
        activeItem : [],
        item: []
    };
    for (i = minRows or  0; //Default value if minRows is not provided
        i < maxRows; i++) {
        switch (i) {
        case 0:
            result.activeItem[i] = result.item[i] = "50dp";
            break;
        case (i <= 10 and i > 0):
            result.activeItem[i] = "40dp";
            result.itemtem[i] = "35dp";
            break;
        default:
            result.activeItem[i] = result.item[i] = 30;
        }
    }
    return result;
 };

これに加えて、ScrollView を作成して、画像を動的に埋め込むことができます。ScrollView の autoSize 機能を true に設定するよりも、そのレイアウトを線形に設定できます。このようにして、ScrollView の動的な高さを設定し、それらを行ごとに scrollView に追加できます。

レイアウトの詳細については、http ://www.smartface.io/developer/guides/controls/layouts/ を参照してください。

于 2015-03-02T11:13:54.147 に答える