样式不适用于Xamarin.Forms中的按钮?

时间:2017-10-26 12:16:25

标签: xaml xamarin xamarin.forms

我正在使用的ContentPage中有这种风格:

@RestController
public class UserResourceImpl implements UserResource {

private final UserDao userDao;
private final AuthenticationService authenticationService;
@Autowired
public UserResourceImpl(final UserDao userDao,final AuthenticationService authenticationService) {
this.userDao = userDao; 
this.authenticationService = authenticationService;
}

@Override
@RequestMapping(method = RequestMethod.POST, value = "/api/user", produces = "application/json")
public ResponseEntity<?> create(final User user) {
    userDao.save(user);
    return new ResponseEntity<>("", HttpStatus.OK);
}

@Override
@RequestMapping(method = RequestMethod.GET, value = "/api/user", produces = "application/json")
public ResponseEntity<?> getUsers(final User user) {


enter code here
    // how to execute the above filter for this request only ?

    return new ResponseEntity<>("", HttpStatus.OK);
}

}

并将其应用于按钮:

 <ContentPage.Resources>
        <ResourceDictionary>
            <Style x:Key="buttonStyle" TargetType="Button">
                <Setter Property="BorderColor" Value="Orange"/>
                <Setter Property="BorderRadius" Value="5"/>
                <Setter Property="BorderWidth" Value="5"/>
                <Setter Property="TextColor" Value="Orange"/>
                <Setter Property="BackgroundColor" Value="Transparent"/>
                <Setter Property="FontSize" Value="13"/>
                <Setter Property="HorizontalOptions" Value="EndAndExpand"/>
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>

我想要完成的是这样的事情(在MS Paint中绘制): enter image description here

但这就是我得到的(来自Android模拟器):

enter image description here

1 个答案:

答案 0 :(得分:0)

代码看起来很好。

请尝试卸载应用程序并删除bin和obj文件夹,然后重建和部署。