我在WPF(xaml)中使用Grid,并且在ColumnDefinition中使用MinWidth属性时我有一些奇怪的效果.例如,当我使用9 ColumnDefinition并且每个ColumnDefinition具有'Width ="*"'属性并且其中一个中间列也具有MinWidth属性时,则其他列的大小是错误的.
好吧,很难描述,但这个xaml代码很好地说明了它:
<Grid Width="500">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*" MinWidth="250"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="Green"/>
<Border Grid.Column="1" Background="Blue"/>
<Border Grid.Column="2" Background="Red"/>
<Border Grid.Column="3" Background="Yellow"/>
<Border Grid.Column="4" Background="Purple"/>
<Border Grid.Column="5" Background="Orange"/>
<Border Grid.Column="6" Background="Azure"/>
<Border Grid.Column="7" Background="LightBlue"/>
<Border Grid.Column="9" Background="LightGreen"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
运行此xaml代码时,您将看到前3列的宽度与最后5列的宽度不同.我希望所有这些都具有相同的宽度.
有谁知道这是一个错误.如果有办法正确地做到这一点.
提前致谢.
我正在尝试为iphone设置移动网页,但无法显示正确的宽度.
问题是..在我页面的大多数帖子中,他们都有宽度约为480px到500px的图片,所以如果我按如下方式设置meta:
1 =这将显示帖子中的所有部分图片,但页面屏幕大于iphone屏幕 ..
name ="viewport"content ="width = 480px; initial-scale = 1; maximum-scale = 1; user-scalable = 1;"
2 =这将显示内部iphone屏幕正确的页面.. 但图像的右侧部分将在立场模式下隐藏到屏幕宽度之外.
name ="viewport"content ="width = device-width; initial-scale = 1; maximum-scale = 1; user-scalable = 1;"
请帮助设置在iPhone和网页中显示完整图像缩放正确的屏幕宽度.
测试使用iphone:http://www.xaluan.com/modules.php?name = News&file = article_mobi&sid = 242186
我有一个ImageButton.代码是 -
ImageButton shareButton = new ImageButton(this);
shareButton.setBackgroundResource(android.R.drawable.ic_menu_share);
RelativeLayout.LayoutParams shareParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
shareParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, navigationLogo.getId());
shareButton.setLayoutParams(shareParams);
Run Code Online (Sandbox Code Playgroud)
我需要改变它的宽度.但是ImageButton和布局参数都没有setWidth方法.在没有答案的情况下在网上看了很多.
我目前TableLayout有3行,每行有一个孩子,a TextView.我的问题是TextViews宽度不是"match_parent"他们应该的.我已经按照不为它们定义高度和宽度的程序(如文档所述)但由于某种原因问题仍然存在.
我已经打开了hierarchyviewer并查看了值,TableRow填充了宽度,但TextView不填充行,它只是包装内容.完整的xml布局如下,有没有人有任何想法?
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="@drawable/textlines"
android:text="@string/text1_string"
android:textColor="#000000"
android:padding="5dp">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="@drawable/textlines"
android:text="@string/text1_string"
android:textColor="#000000"
android:padding="5dp">
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="@drawable/textlines"
android:text="@string/text1_string"
android:textColor="#000000"
android:padding="5dp">
</TextView>
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
另外,我将包含xml文件@drawable/textlines.也许问题在那里?(textlines代码取自这里提供的关于边界问题的解决方案)我非常理解它,我认为它不应该影响我的问题,但我可能是错的.无论如何,这里是:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape
android:shape="rectangle">
<stroke android:width="1dp" android:color="#FF000000" />
<solid android:color="#FFDDDDDD" />
</shape>
</item> …Run Code Online (Sandbox Code Playgroud) 我正在使用没有指定高度和宽度的TabControl.实际上,TabControl的高度取当前选项卡的高度.
我不希望TabControl自动调整它的大小.我希望它采用最大标签的大小(Heigth和Width).
我怎样才能做到这一点 ?
谢谢.
我有一个关于我正在研究的关于检测窗口调整大小的网站的问题.我知道这已经在前面讨论过了,我已经阅读了很多讨论,但却无法让它发挥作用.我只是在学习jquery.
$(function(){
var viewPortWidth = $(window).width();
if (viewPortWidth > 1900)
{
$('#mainbio, #footerlinks').addClass('extraWide')
}
else if (viewPortWidth > 1400)
{
$('#mainbio, #footerlinks').addClass('wide')
}
else if (viewPortWidth > 1000)
{
$('#mainbio, #footerlinks').addClass('standard')
}
else if (viewPortWidth > 700)
{
$('#mainbio, #footerlinks, #twitter, #facebook, #flickr, #lastfm').addClass('narrow')
}
else
{
$('#mainbio, #footerlinks, #twitter, #facebook, #flickr, #lastfm').addClass('extraNarrow')
}
});
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止,它工作正常,但只在初始加载.我想知道是否有人可以帮助我调整它以便它可以动态工作 - 所以我可以看到更改,如果我手动调整我的浏览器,而不刷新?
谢谢!
我想div { width:33%; border: 3px solid #333;}在一页内放三个.但它只是失败了,就好像总和高于100%.
如何并排浮动3个div并占据宽度:100%没有搞乱?
我想在datagridview中手动更改列宽.我该怎么办?我应该更改designer.cs中的代码还是只更改.cs中的代码?
我在代码中添加了一些内容,但它不起作用:
dataGridView1.Columns[0].Width = 200;
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
private void sqlConnResident()
{
BindingSource dbBindSource = new BindingSource();
SqlCommand com;
com = new SqlCommand();
SqlConnection con = new SqlConnection(strCon);
com.Connection = con;
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "view_penghuni";
SqlDataAdapter dataAdapter = new SqlDataAdapter(com);
IDCabang = new SqlParameter();
IDCabang.SqlDbType = SqlDbType.VarChar;
IDCabang.Size = 5;
IDCabang.ParameterName = "@IDCabang";
IDCabang.Value = IDCabangC;
IDCabang.Direction = ParameterDirection.Input;
com.Parameters.Add(IDCabang);
con.Open();
DataTable table = new DataTable();
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter.Fill(table);
dbBindSource.DataSource = table;
//dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
// you can make it grid …Run Code Online (Sandbox Code Playgroud) 当您翻转坐标时,如何减少窄条和面板边框之间的空间?使用数据框df和ggplot命令,底栏和刻度线之间有很多空白区域(同样是"供应商"栏上方的宽阔空间).
df <- data.frame(x = c("firm", "vendor"), y = c(50, 20))
ggplot(df, aes(x = x, y = y)) +
geom_bar(stat = "identity", width = 0.4) +
theme_tufte() + coord_flip() +
labs(x = "", y = "")
Run Code Online (Sandbox Code Playgroud)
我尝试scale_x_discrete了两者limits和expand参数都无济于事position = position dodge,同样没有效果.
这个问题提供coord_equal了改变宽高比,从而减少或消除额外空间,但注意到该解决方案不起作用coord_flip.
我想将自定义UITableViewCell的宽度设置为屏幕宽度的80%,但我知道可以使用"layoutSubviews()"方法操作单元格的大小,但我不知道如何操作.
请帮我.