2017-03-28 8 views
0

私はWindows SDK 10.1.GAとAlloy 1.9.8を学び始めたので、ギャラリーから選択したイメージで埋められたImageViewを表示したいと考えています。このコンポーネントは、 .tssがあるためTitanium ImageViewの親の内側に正しくスケールする方法は?

<Alloy> 
    <Window class="container"> 
     <ActionBar id="actionBar" platform="android" title="Contact Details"></ActionBar> 
     <Menu> 
      <MenuItem id="saveContactMenu" title="Save" onClick="saveContact"/> 
     </Menu> 
    <View class="contact-details-holder"> 
     <View class="contact-photo-holder" onClick="openOptions"> 
     <ImageView id="photo" class="contact-photo"/> 
     </View> 
     <View class="contact-info-holder"> 
     <Label class="label">Nombre</Label> 
     <Label id="fullname" class="text"/> 
     </View> 
     <View class="address-info-holder"> 
     <View class="address-holder"> 
      <Label class="label">Direccion</Label> 
      <Label id="address" class="text"/> 
     </View> 
     <View class="map-holder"> 
     </View> 
     </View> 
     <View class="contact-info-holder"> 
     <Label class="label">T</Label> 
     <Label id="phone" class="text"/> 
     </View> 
    </View> 
     <OptionDialog id="photoDialog" title="Select source" onClick="handleSelectedOption" cancel="3"> 
     <Options> 
      <Option>Camera</Option> 
      <Option>Photo Gallery</Option> 
         <Option>From the Web</Option> 
      <Option>Cancel</Option> 
     </Options> 
    </OptionDialog> 
    </Window> 
</Alloy> 

'.container' : { 
    width : Ti.UI.FILL, 
    height : Ti.UI.FILL, 
    backgroundColor:'white' 
} 

'.contact-details-holder' : { 
    width : Ti.UI.FILL, 
    height : Ti.UI.SIZE, 
    layout: "vertical" 
} 

'.contact-photo-holder': { 
     width : Ti.UI.FILL, 
     height : '44 dp', 
    top: 0, 
    backgroundColor: "pink" 
} 

'.contact-photo': { 
    width : Ti.UI.SIZE, 
    height: Ti.UI.SIZE 
} 

'.contact-info-holder' : { 
    width : Ti.UI.FILL, 
    height: Ti.UI.SIZE, 
    top: 0, 
    layout: "vertical", 
    backgroundColor: "lime" 
} 

'.label': { 
    width : Ti.UI.SIZE, 
    height: Ti.UI.FILL, 
    left : 0, 
    font: { 
     fontFamily:'Helvetica', 
     fontSize: '12dp', 
     fontStyle: 'normal', 
     fontWeight: 'normal' 
    }, 
    color: '#343434' 
} 

'.text': { 
    width : Ti.UI.SIZE, 
    height: Ti.UI.FILL, 
    left : 0, 
    font: { 
     fontFamily:'Helvetica', 
     fontSize: '12dp', 
     fontStyle: 'normal', 
     fontWeight: 'normal' 
    }, 
    color: 'black' 
} 

ImageViewのは、その幅を有しているビューは、そのTi.UI.FILLに設定幅と44のDPSの高さを持っている。このようなXML高さをTi.UI.SIZEに設定すると、元の画像のサイズになると予想され、Viewの上にクリップが表示され、画像は、それがこの、次の画像のように示されています:

enter image description here

アムは、私がTSSに間違ったスタイルを適用しますか?

答えて

1

"#photoContainer":{ 
    width : Ti.UI.FILL, 
    height : Ti.UI.SIZE 
} 
"#photo":{ 
    left: 0, 
    right : 0, 
    height : "auto" 
} 
.tssこの

の.xml

<View class="contact-photo-holder" onClick="openOptions"> 
    <View id="photoContainer"> 
    <ImageView id="photo" class="contact-photo"/> 
    </View> 
</View> 

を試してみてください

関連する問題