小编Abo*_*udi的帖子

是否可以在样式中设置约束布局属性?

当我在活动的 xml 源中设置以下约束布局属性时,我得到了预期的结果,但是当我在样式中设置它们时,根本不会处理设置的值。

<style name="vrm_entry_number_button" parent="@android:style/Widget.Button">
    <item name="android:layout_margin">7dp</item>
    <item name="android:background">#496587</item>
    <item name="android:layout_width">0dp</item>
    <item name="android:layout_height">0dp</item>

    <item name="app:layout_constraintHeight_default">percent</item>
    <item name="app:layout_constraintHeight_percent">0.90</item>
    <item name="app:layout_constraintWidth_default">percent</item>
    <item name="app:layout_constraintWidth_percent">0.10</item>
</style>
Run Code Online (Sandbox Code Playgroud)

这可能是什么原因,是否有替代方案?

android

4
推荐指数
1
解决办法
856
查看次数

我如何使用多种简单类型 PostAsync()?

我如何使用多个简单类型作为参数 PostAsync(),我有下面的动作控制器:

[HttpPost]
[Route("users/verifyLoginCredentials/{username}/{password}")]
public IHttpActionResult VerifyLoginCredentials([FromUri]string username, string password)
{

   //Do Stuff......
   return Ok("Login Successful");

}
Run Code Online (Sandbox Code Playgroud)

我正在尝试从 .Net Framerwork 4.5 客户端应用程序调用它,如下所示:

static async Task<Uri> CreateProductAsync(string username, string password)
{


     HttpClient client = new HttpClient();
     client.BaseAddress = new Uri(uri);
     client.DefaultRequestHeaders.Accept.Clear();
     client.DefaultRequestHeaders.Accept.Add(
            new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
     client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/json"));

     var value = new Dictionary<string, string>
     {
        { "username", "test123" }
     };

     var content = new FormUrlEncodedContent(value);
     var result = await client.PostAsync("users/verifyLoginCredentials/{username}/{password}", content);
     string resultContent = await result.Content.ReadAsStringAsync();

     result.EnsureSuccessStatusCode();

     // return URI of the …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-web-api

1
推荐指数
1
解决办法
7506
查看次数

标签 统计

android ×1

asp.net-web-api ×1

c# ×1