有没有办法使用CSS控制边框颜色的不透明度/透明度?
我已经实现了GalleryView.我想在Gallery中选择的图像上显示边框图像.
Gallery ga = (Gallery)findViewById(R.id.Gallery01);
ga.setAdapter(new ImageAdapter(this));//, android.R.layout.simple_list_item_1, items));
imageView = (ImageView)findViewById(R.id.ImageView01);
ga.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapter, View view, int location,
long arg3) {
imageView.setImageResource(items.get(location));
final ImageView iv = (ImageView) adapter.getSelectedView();
iv.setBackgroundResource(R.drawable.large_button_sel_liner);
}
});
Run Code Online (Sandbox Code Playgroud)
和我的Adapter类
class ImageAdapter1 extends ArrayAdapter<Integer> {
private Context ctx;
private List<Integer> items;
public ImageAdapter1(Context context, int textViewResourceId,
List<Integer> objects) {
super(context, textViewResourceId, objects);
items = objects;
ctx = context;
}
@Override
public int getCount() {
return items.size();
}
@Override
public View getView(int position, …Run Code Online (Sandbox Code Playgroud) 我有这个代码:
<Window x:Class="WpfApplication8.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ScrollViewer Background="#FFADB9CD" >
<Grid>
<Border Name="mask" Height="{Binding ElementName=cnvsEtikett, Path=Height}" Width="{Binding ElementName=cnvsEtikett, Path=Width}" Background="White" CornerRadius="6"/>
<Canvas Height="100" Name="cnvsEtikett" Width="200" Background="White" ClipToBounds="True">
<Canvas.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask}" />
</Canvas.OpacityMask>
<TextBlock Height="23.2" Text="TextBlock" Canvas.Left="63" Canvas.Top="41" />
</Canvas>
</Grid>
</ScrollViewer>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
我希望画布具有圆角,直到我将文本块拖动到任一侧之前,它都可以工作。然后角落消失了。这是我程序中窗口的简单重现,我在那里使用拖放操作来移动文本块。我确实需要那些圆角,但是我绝对不知道如何解决这个问题!
有任何想法吗??
编辑:当文本块移动到边缘时,似乎画布被拉伸了(因为拐角半径也改变了!)
这是我的代码:
<html>
<head>
<style type="text/css">
p:hover{border:2px solid red;}
</style>
</head>
<body>
<p style="border:2px solid green;">This is a paragraph.</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我很困惑:为什么悬停时边框颜色不会改变?
如何使用CSS创建动态角框架,如下图所示?
下面是我目前的解决方案,但它不够动态,因为我有两个不同宽度的内容,
<p class="description-header">
<span class="frame-header frame-header-top"></span>
<span class="description-text"><?php echo $home->excerpt;?></span>
<span class="frame-header frame-header-bottom"></span>
</p>
Run Code Online (Sandbox Code Playgroud)
CSS,
.description-header {
position:absolute;
bottom:0;
right:0;
width:182px;
font-size:12px;
line-height:14px;
margin:0;
padding:0;
border:0 solid red;
}
.frame-header {
display:block;
width:182px;
height:10px;
float:none;
background-image:url(../images/frame-header.jpg);
background-repeat: no-repeat;
margin:0;
border:0 solid red;
}
.frame-header-top {
background-position: top left;
}
.frame-header-bottom {
background-position: bottom left;
}
.description-text {
width:160px;
display:block;
float:none;
margin: 0 auto;
border:0 solid red;
}
Run Code Online (Sandbox Code Playgroud)
有更好的想法吗?
在这种颜色#505050上使用CSS创建雕刻边框有什么技巧吗?我几个小时以来一直在网上搜索,但找不到任何CSS解决方案.虽然,我本可以在Photoshop上制作,但我不擅长.
我正在构建动态JDialogs.我有一些JPanels,当你选择一个菜单选项我创建一个模态JDialog,添加一个JPanel并显示它:
JDialog dlg = new JDialog(this, title, true);
dlg.getContentPane().add(panel);
dlg.pack();
dlg.setLocationRelativeTo(null);
dlg.setVisible(true);
Run Code Online (Sandbox Code Playgroud)
我的应用程序运行良好,但JDialog的边框和添加的面板之间没有空间,它看起来非常"完整/拉伸"(对不起,我不知道该怎么说).也许问题是我正在调用JDialog.pack(),但是在运行时我不知道面板的大小,所以我创建了没有维度的JDialog,并且在添加内容后我将其打包.
我的问题是:我可以做些什么来增加面板周围的空间?
一种可能的解决方案是添加BorderLayout,将面板放在中心,每侧有4个固定尺寸的面板......但这看起来很难看......
我想使用border-image作为流畅的缩放CSS容器.是否可以使用某些.js框架在所有现代浏览器上启用此CSS3功能?如果没有,是否有一个很好的替代品?
有关我想要实现的目标的示例,请参阅:http: //www.css3.info/preview/border-image/
我是css的新手,我想和你讨论这个问题:
假设我们有一个名为A的div和它的宽度= X px,我们里面还有2个div,div B和div C.
div B:
width: 20%;
border: 1px;
Run Code Online (Sandbox Code Playgroud)
div C:
width: 80%;
border: 1px;
Run Code Online (Sandbox Code Playgroud)
这样,这两个div的宽度总和如下:
20% + 80% + 2(1px left border + 1px right border) => 100% (" width of div A) + 4px
问题是如何使B和C的宽度等于宽度A而不管它们的边界宽度如何?
我刚收到设计师的PSD,大部分的部分都可以通过CSS实现,我只想做一件我觉得难以理解的是一个有2个边框的圆圈.我可以使用bg图像方法,但使用CSS3是理想的.
使用CSS的一个主要原因是在几个不同的元素上使用了相同的边框.