Val*_*rie 3 nativescript angular2-nativescript nativescript-telerik-ui
我需要创建一个图像按钮,其中包含自定义图像和{N} + Angular中的标签.像这样的东西:
这是我的代码.我正在使用网格布局中的堆栈布局.我看不到图像下方的标签.
<GridLayout columns="*,*" rows="*,*,*,*,*,*" width="400" height="400">
<StackLayout class=" btn-sq-lg " col="0" row="0" (tap)="gotoSRTPage()">
<Image col="0" row ="1" src="res://ic_briefcase" > </Image>
<Label class= "label" textWrap="true" col="0" row="2" text="SRT" horizontalAlignment="center" verticalAlignment="center"></Label>
</StackLayout>
<StackLayout class=" btn-sq-lg " col="1" row="0" (tap)="">
<Image col="1" row ="1" src="res://ic_blog" > </Image>
<Label class= "label" col="1" row="2" text="SRT" horizontalAlignment="center" verticalAlignment="center"</Label>
</StackLayout>
<StackLayout class=" btn-sq-lg " col="0" row="3" (tap)="">
<Image col="0" row ="4" src="res://ic_reminder" > </Image>
<Label class= "label" textWrap="true" col="0" row="5" text="SRT" horizontalAlignment="center" verticalAlignment="center"></Label>
</StackLayout>
<StackLayout class=" btn-sq-lg " col="1" row="3" (tap)="">
<Image col="1" row ="4" src="res://ic_announcement" > </Image>
<Label class="label" textWrap="true" col="1" row="5" text="SRT" horizontalAlignment="center" verticalAlignment="center"></Label>
</StackLayout>
</GridLayout>
Run Code Online (Sandbox Code Playgroud)
css文件:
.btn-sq-lg {
background-color: white;
}
.label {
text-align: center;
color:#00caab;
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,我还没有找到一个直截了当的方法,但我有一个解决方法
您可以尝试以下方法
<StackLayout class="btn-img" orientation="horizontal" padding="5" (tap)="onTappedFun()" >
<Image src="res://facebook" width="10%" height="100%" marginRight="10"></Image>
<Label text="Login via Facebook" verticalAlignment="center"></Label>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
.btn-img{
border-radius: 5;
border-width: 1;
color: white;
margin: 10;
font-size: 22;
border-color: #2b3c6a;
background-color: #3B5997;
}
Run Code Online (Sandbox Code Playgroud)
onTappedFun(){
console.log("Hey i was tapped");
}
Run Code Online (Sandbox Code Playgroud)
mas*_*mon -4
<Button>
<Image res="<path>"></Image>
<Label text="{{text}}"></Label>
</Button>
Run Code Online (Sandbox Code Playgroud)
- 编辑 -
为什么我对此被否决了?它回答了所提出的问题吗?
| 归档时间: |
|
| 查看次数: |
7659 次 |
| 最近记录: |