标签: rounded-corners

在UIImageView上设置角半径不起作用

我有点失落.我已经使用UIView的图层属性来围绕我的应用程序中的多个元素的角落.但是,这一个UIImageView根本就不符合.不确定我错过了什么.

UIImageView(称为previewImage)包含在表视图单元格中.我已经尝试将cornerRadius属性设置为多个位置(在单元格本身和创建单元格的控制器中)无济于事.

static NSString *CellIdentifier = @"MyTableViewCell";

MyTableViewCell *cell = (MyTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:self options:nil];
    cell = [topLevelObjects objectAtIndex:0];
    cell.previewImage.layer.cornerRadius = 20; //Made it 20 to make sure it's obvious.
}
Run Code Online (Sandbox Code Playgroud)

有没有关于细胞加载的方式,我错过了?

iphone rounded-corners uiimageview ios

121
推荐指数
4
解决办法
8万
查看次数

如何创建WPF圆角容器?

我们正在创建一个XBAP应用程序,我们需要在单个页面中的不同位置具有圆角,并且我们希望有一个WPF Rounded Corner容器来放置一堆其他元素.有没有人对我们如何才能最好地完成这项工作有一些建议或示例代码?使用样式或创建自定义控件?

wpf rounded-corners

106
推荐指数
3
解决办法
16万
查看次数

如何以编程方式圆角和设置随机背景颜色

我想围绕视图的角落,并在运行时根据内容更改视图的颜色.

TextView v = new TextView(context);
v.setText(tagsList.get(i));
if(i%2 == 0){
    v.setBackgroundColor(Color.RED);
}else{
    v.setBackgroundColor(Color.BLUE);
}

v.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
v.setPadding(twoDP, twoDP, twoDP, twoDP);               
v.setBackgroundResource(R.drawable.tags_rounded_corners);
Run Code Online (Sandbox Code Playgroud)

我希望设置一个drawable,颜色会重叠,但他们没有.无论我执行第二个是生成的背景.

有没有办法以编程方式创建此视图,请记住,直到运行时才会确定背景颜色?

编辑:我现在只在红色和蓝色之间进行测试.之后,用户可以选择颜色.

编辑:

tags_rounded_corners.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <corners 
         android:bottomRightRadius="2dp" 
         android:bottomLeftRadius="2dp" 
         android:topLeftRadius="2dp" 
         android:topRightRadius="2dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

android background rounded-corners android-layout android-view

105
推荐指数
6
解决办法
10万
查看次数

IOS:创建一个带圆角的UIImage或UIImageView

是否可以创建一个圆角UIImageUIImageView圆角?因为我想拿一个UIImage并在里面展示它UIImageView,但我不知道该怎么做.

objective-c rounded-corners uiimage ios

98
推荐指数
4
解决办法
9万
查看次数

UIView的两个角落

不久之前,我发布了一个关于在视图的两个角上进行四舍五入的问题,得到了很好的响应,但是在实现它时遇到了问题.这是我的drawRect:方法:

- (void)drawRect:(CGRect)rect {
    //[super drawRect:rect]; <------Should I uncomment this?
    int radius = 5;
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextBeginPath(context);
    CGContextAddArc(context, rect.origin.x + radius, rect.origin.y + rect.size.height - radius, radius, M_PI, M_PI / 2, 1);
    CGContextAddArc(context, rect.origin.x + rect.size.width - radius, rect.origin.y + rect.size.height - radius, radius, M_PI / 2, 0.0f, 1);
    CGContextClosePath(context);
    CGContextClip(context);
}
Run Code Online (Sandbox Code Playgroud)

正在调用该方法,但似乎不会影响视图的结果.有什么想法吗?

iphone objective-c rounded-corners ios

77
推荐指数
7
解决办法
7万
查看次数

圆形表角只有CSS

我进行了搜索和搜索,但未能找到符合我要求的解决方案.

我有一个简单的HTML表格.我想要它的圆角,使用图像或JS,即纯CSS.像这样:

表格布局草图

角部细胞的圆角和细胞的1px粗边.

到目前为止我有这个:

table {
  -moz-border-radius: 5px !important;
  border-collapse: collapse !important;
  border: none !important;
}
table th,
table td {
  border: none !important
}
table th:first-child {
  -moz-border-radius: 5px 0 0 0 !important;
}
table th:last-child {
  -moz-border-radius: 0 5px 0 0 !important;
}
table tr:last-child td:first-child {
  -moz-border-radius: 0 0 0 5px !important;
}
table tr:last-child td:last-child {
  -moz-border-radius: 0 0 5px 0 !important;
}
table tr:hover td {
  background-color: #ddd !important …
Run Code Online (Sandbox Code Playgroud)

html css html-table rounded-corners

76
推荐指数
7
解决办法
23万
查看次数

Android中的圆形按钮

我想在Android程序中创建圆形按钮.我看过 如何用圆角创建EditText?

我想要实现的是:

  1. 圆形边缘按钮
  2. 更改不同状态下的按钮背景/外观(如Onclick,Focus)
  3. 使用我自己的PNG作为背景而不是创建形状.

android rounded-corners android-button

69
推荐指数
5
解决办法
19万
查看次数

WPF矩形 - 圆顶角

我怎样才能让WPF矩形的顶角变圆?我创建了一个边框并设置了CornerRadius属性,在边框内我添加了我的矩形,但它不起作用,矩形没有圆角.

<Border BorderThickness="1" CornerRadius="50,50,0,0" BorderBrush="Black">
    <Rectangle Fill="#FF5A9AE0" Stretch="UniformToFill" ClipToBounds="True"/>
</Border>
Run Code Online (Sandbox Code Playgroud)

wpf rounded-corners

61
推荐指数
3
解决办法
7万
查看次数

IE8中的CSS圆角

我在IE8中遇到圆角问题.我尝试了一些没有成功的方法.

这是我的代码:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>

<style>
body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8em;
  padding: 2px;
  margin: 2px;
  color: #505050;
  line-height: normal;
}
p {
  margin: 4px;
}
.categoryheading3 {
  -moz-border-radius-topleft: 5px;
  -moz-border-radius-topright: 5px;
  -webkit-border-top-left-radius: 5px;
  -webkit-border-top-right-radius: 5px;
  background-color: #297BB6;
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 0;
  text-align: center;
  margin: 0px;
}
.leftcolumn {
  width: 174px;
  padding: 8px;
  float: left;
  display: inline-block;
  background-color: transparent;
  /*--min-height: 500px*/
  overflow: hidden;
}
.lefttop {
  display: inline-block;
  width: inherit;
  margin: …
Run Code Online (Sandbox Code Playgroud)

css internet-explorer rounded-corners internet-explorer-8

58
推荐指数
2
解决办法
13万
查看次数

如何制作带圆角的UIImage/-View CGRect(Swift)

如何在Swift iOS Playground上制作带圆角的UIImageView?
里面需要填充颜色.

rounded-corners uiimageview swift swift-playground

57
推荐指数
5
解决办法
8万
查看次数