所以,我正在以编程方式添加标签,我需要将上边距稍微改为值8.我不能以明显的方式做到这一点,所以我的想法出了什么问题?
Dim LabelAdapter As New Label
LabelAdapter.text = "Adapter"
LabelAdapter.Margin.Top = 8
Run Code Online (Sandbox Code Playgroud)
这给了我错误"表达式是一个值,因此不能成为赋值的目标".
我正在创建包含a的动态视图LinearLayout并将它们添加到外部LinearLayout.我想在创建的视图周围设置边距,但layout_margin忽略XML文件中的边距.如果我在代码中设置参数,它可以工作,但我想在布局XML中指定边距.
设置XML布局中的边距将被忽略:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:orientation="vertical" >
...
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
在创建时设置边距是值得尊重的:
LinearLayout productView = (LinearLayout) getLayoutInflater().inflate(R.layout.product_preview, null);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
params.setMargins(50, 50, 50, 50);
productView.setLayoutParams(params);
Run Code Online (Sandbox Code Playgroud)
这是外部布局.视图已添加到dealer_activity_product_list.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/dealer_activity_dealer_image"
android:layout_width="match_parent"
android:layout_height="150dp"
android:contentDescription="@string/dealer_activity_dealer_image_desc" />
<TextView
android:id="@+id/dealer_activity_dealer_address"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/dealer_activity_product_list1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" />
<LinearLayout
android:id="@+id/dealer_activity_product_list2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我的Flutter布局有问题.
我有一个简单的容器,右边和左边的边距为20.0.在这个容器内,我有另一个容器.
但是这个容器只适合左侧的父容器.我不知道为什么会这样.
这是我的代码:
@override
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Colors.white,
body: new Container(
margin: new EdgeInsets.symmetric(horizontal: 20.0),
child: new Container(
)
),
);
}
Run Code Online (Sandbox Code Playgroud)
我已经看过十几个脚本可以捕获页面中元素/对象的x和y位置.但是当网页在主体上使用边距或其他元素,绝对/相对元素(如此类似)时,我总是遇到捕捉x和y的问题.
无论使用什么边距或填充,是否有提供精确位置的解决方案.
:)
出于某种原因,我在桌子上得到1px填充或边框.我无法弄清楚如何摆脱它.我已经尝试添加display:block;margin:0;padding:0;到图像,但这并没有解决它.我也试着<table border="0">和border:none;在CSS.对于我的生活,我无法弄清楚这一点.
这是一个问题的原因是因为我试图让图像与tr两侧的边缘对齐,以给它圆形边框,因为CSS3 border-radius不适用于TR.我已经添加table, table * {border:1px solid red;}到CSS,从那里,它肯定看起来像填充或边距问题.
问题出在这张图片中:

在左侧和右侧,您可以看到图像和桌子边缘之间存在某种填充或某种东西.红色边框只是为了看到这一点.
这是我的CSS:
table a {
color: #f7941E;
font-family: Arial;
font-size: 16px;
font-weight: bold;
/* css3 */
transition: color .25s;
-khtml-transition: color .25s;
-moz-transition: color .25s;
-o-transition: color .25s;
-webkit-transition: color .25s;
}
table a:hover {
color: #f8ae57;
}
table {
width: 610px;
}
table tr {
height: 33px;
padding: 0;
margin: 0;
vertical-align: middle;
}
table td {
border-collapse: collapse;
}
table …Run Code Online (Sandbox Code Playgroud) 我有一RelativeLayout排进入一个ListView.这行看起来像,
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/placeDetailIcon_Img"
android:layout_height="50dp"
android:layout_width="50dp"
android:layout_alignParentLeft="true"
android:paddingBottom="20dp"
android:paddingTop="20dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我还尝试了保证金:
<ImageView
android:layout_height="50dp"
android:layout_width="50dp"
android:id="@+id/placeDetailIcon_Img"
android:layout_alignParentLeft="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp">
Run Code Online (Sandbox Code Playgroud)
没有应用边距或填充围绕ImageView.如何创建这种类型的间距?
我有一个绑定值,返回一个int,表示我没有分配给元素的左右边距的值.
继承人我尝试过但它不会编译.
如果我设置整个边距,它可以工作,但我只想要左右.
XAML:
<Image x:Name="_image" Source="mat.png" Margin="{Binding EditorRow.BondIndent},0,{Binding EditorRow.BondIndent},0" />
Run Code Online (Sandbox Code Playgroud)
类:
public int BondIndent
{
get { return _bondSequence * 5; }
}
Run Code Online (Sandbox Code Playgroud) 我有一个#box宽度为100%的盒子,高度:100%,填充:5px,边距:5px; 边界:5px;
我需要在HTML5布局中正确显示它.
现在我有:

但我需要在身体区域适合阻滞.
码:
<!DOCTYPE html>
<style>
body,html {
width: 100%;
height: 100%;
margin: 0;
}
#box {
width: 100%;
height: 100%;
border: 5px solid red;
padding: 15px;
margin: 20px;
}
</style>
<body>
<div id="box">
Text will be here
</div>
</body>
Run Code Online (Sandbox Code Playgroud) 如何将 Flutter Chip 小部件的顶部和底部边距设置为零?
所以我可以得到这个

而不是这个
