首页 \ 问答 \ 如何使用xml设置可绘制颜色的圆角半径?(How do I set the rounded corner radius of a color drawable using xml?)

如何使用xml设置可绘制颜色的圆角半径?(How do I set the rounded corner radius of a color drawable using xml?)

在android网站上,有一个关于彩色绘图的部分 。 在xml中定义这些可绘制如下所示:

<resources>
    <drawable name="solid_red">#f00</drawable>
    <drawable name="solid_blue">#0000ff</drawable>
    <drawable name="solid_green">#f0f0</drawable>
</resources>

在java api中,它们具有以下方法来定义圆角:

setCornerRadius(float radius)

有没有办法在xml中设置圆角?


On the android website, there is a section about color drawables. Defining these drawables in xml looks like this:

<resources>
    <drawable name="solid_red">#f00</drawable>
    <drawable name="solid_blue">#0000ff</drawable>
    <drawable name="solid_green">#f0f0</drawable>
</resources>

In the java api, they have thr following method to define rounded corners:

setCornerRadius(float radius)

Is there a way to set the rounded corners in the xml?


原文:https://stackoverflow.com/questions/2122199
更新时间:2022-05-07 09:05

最满意答案

自己实现! 应该会很好玩。 创建一个单独的应用程序,它只包含更新逻辑,即在线获取文件,下载它们,替换本地文件,并向用户显示。

因此,您的主要应用程序可以检查更新,如果存在,将提示用户更新的可能性。 如果用户想要的话,它将运行更新程序,使其自身关闭(因此可能会发生更新)和presto。

您只需要在C#,FTP访问和IO中轻松访问。

编辑:我知道这不是一件非常容易的事情,但这是一个完美的机会:

  • 如何(正确)下载文件,以抽象的方式可以扩展到ftp,http等
  • 如何(正确地)对许多文件执行简单的任务 - 复制或覆盖它们(这意味着错误处理)。
  • 实践(因为没有“正当”的方式)来分层和封装一块软件。
  • 如何处理OS /其他软件(防病毒/防火墙等)不合作。

这些都是我们都需要知道的事情 - 如果编写更新程序需要几周的时间,这意味着您需要几周的学习。 如果你不需要学习,时间磨练你的技能! 如果你不知道你是否需要,有时间找出来! :)

注意:我知道需要学习更好的文件和网络I / O


Should've updated this ages ago, oops!

But anyway, I've been using SparkleDotNET for a while now and it's been working absolutely wonderfully. There's a few little bugs here and there but I've already helped get some of them squashed, and hopefully I'll be able to get rid of the others too :)

For those who have the time to run the publish functionality of Visual Studio, and whose app is relatively self-contained, and doesn't require anything like launching on startup, I'd recommend ClickOnce for sure. MetroTwit uses it and it's got a nice in-app updater interface, so it seems flexible (at least to a certain degree). For launching on startup, it's possible to do so, but methods to do so are quite hacky and don't work that well.

相关问答

更多
  • 自己实现! 应该会很好玩。 创建一个单独的应用程序,它只包含更新逻辑,即在线获取文件,下载它们,替换本地文件,并向用户显示。 因此,您的主要应用程序可以检查更新,如果存在,将提示用户更新的可能性。 如果用户想要的话,它将运行更新程序,使其自身关闭(因此可能会发生更新)和presto。 您只需要在C#,FTP访问和IO中轻松访问。 编辑:我知道这不是一件非常容易的事情,但这是一个完美的机会: 如何(正确)下载文件,以抽象的方式可以扩展到ftp,http等 如何(正确地)对许多文件执行简单的任务 - 复制或覆盖 ...
  • 如果您知道在部署之后您的C ++ DLL将与C#DLL(或可执行文件)位于同一文件夹中,那么解决问题的简单方法是使用PostBuild事件(项目属性,构建事件)。 您可以添加一个复制命令,将C ++ DLL放入C#输出文件夹。 I found a very comfortable way, which might have some unexpected drawbacks, but I do not see any so far: I can enable CLR for the C++ DLL proj ...
  • 将客户端应用程序更新推送到某人的计算机只会危及用户的计算机和数据。 但是,您无法自动将更新推送到其他人的服务器。 你不知道他们的环境是什么,以及通过推动你的更新可以打破什么。 鉴于您的员工将使用您的应用将内容发布给用户,您将面临用户业务风险。 Pushing a client app update to somebody's computer is putting to risk only that user's computer and data. However, you can't automatic ...
  • 如何以编程方式阻止对平板电脑进行强制馈送更新? 建立你自己的固件并使用它而不是股票固件。 Google可能会强制改变平板电脑,这可能会破坏我们的应用程序。 阻止固件更新的风险在于三星(而不是Google)可以向平板电脑提供更新,修复固件中的缺陷,以便客户理解(例如更好的WiFi连接)。 请理解您正在使用的设备是消费类设备。 此类设备不打算用于“控制工业过程”。 期望的是,如果您在这些设置中使用Android,您将获得自己的设备并控制您的固件。 唉,目前没有太多的支持, 我最近写了一些内容 。 How can ...
  • 这不是层数的问题。 问题是您的数据访问逻辑如何处理并发。 处理并发应该发生在处理数据访问的任何层中,无论您拥有多少层。 但我了解您的来源,因为.NET控件和组件可以隐藏此功能并减少所需的层数。 乐观并发解析有两种常用方法。 第一种是在行上使用时间戳来确定用户在开始编辑时所看到的版本是否在他们提交编辑时被修改。 请记住,这不一定是正确的Timestamp数据库数据类型。 不同的系统将使用不同的数据类型,每种类型都有其自身的优点和缺点。 这是一种更简单的方法,适用于大多数设计良好的数据库。 第二种常见方法是,在 ...
  • 没有.Visual Basic和C#项目编译得非常快 - 所以可能没什么区别。 此外,由于它们都编译为相同或类似的IL,因此运行时性能差别不大。 然而,就长期可维护性而言可能具有优势。 拥有单一语言代码库通常更容易维护,特别是对于多个开发人员。 No. Visual Basic and C# projects both compile very quickly - so there is likely to be little difference. Also, since they both compil ...
  • 点网自动更新 我已经实现了一个名为DotNetAutoUpdate的库(原名eh?)。 它的目标是: 简单易用 设置简单 安全 - 请参阅自动更新:这是安全的吗? 它目前不处理差异补丁,但可能在未来。 Dot Net Auto Update I've implemented a library to do this called DotNetAutoUpdate (original name eh?). It aims to be: Simple to use Simple to setup Secure ...
  • 您只需要在pass.json中使用webServiceURL和authenticationToken来显示该选项。 要使更新生效,您需要在服务器上实现Web服务协议。 You simply need to have a webServiceURL and authenticationToken in your pass.json to make the option appear. For updates to work then you will need to implement the web ser ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。