Tag: 布局

*(星号)在WPF ColumnDefinition中的含义? (可用空间的加权比例)

*(星号)在下面的XAML中是什么意思? <ColumnDefinition Width="0.07*"/> <Grid Height="100" HorizontalAlignment="Left" Margin="102,134,0,0" Name="grid1" VerticalAlignment="Top" Width="354"> <Grid.ColumnDefinitions> <ColumnDefinition Width="40*" /> <ColumnDefinition Width="314*" /> </Grid.ColumnDefinitions> </Grid>

适用于Android的突破性小部件布局

我正在尝试创build一个向用户显示一些数据的活动。 数据是这样的,它可以分成“单词”,每个单词都是一个小部件,“单词”序列将形成数据('句子'?),包含单词的ViewGroup小部件。 由于“句子”中所有“单词”所需的空间将超过显示器上可用的水平空间,因此我想将这些“句子”包装成正常的文本。 以下代码: public class WrapTest extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout l = new LinearLayout(this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams mlp = new LinearLayout.LayoutParams( new ViewGroup.MarginLayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); mlp.setMargins(0, 0, 2, 0); for (int i = […]

Android:切断了最后一行的textview

我有一个水平的LinearLayout包含一个TextView紧接着旁边的Spinner 。 这个LinearLayout在RelativeLayout包含的固定垂直LinearLayout中被dynamic地多次膨胀。 问题是,因为我从Theme.light切换到Theme.holo.light , TextView的最后一行被切成两半。 当dynamic文本很长并跨越多行时,会发生这种情况。 我已经能够通过添加底部填充到包含TextView和Spinner的水平LinearLayout来解决这个问题。 这不是一个修复,但更多的是一个黑客。 有人可以请给我一些build议,如何妥善解决这个问题? 我也读了一些其他的问题,但似乎没有任何帮助。 水平线性布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/textView1" android:layout_width="150dp" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:text="TextView"/> <Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> 相对布局,其中上面的布局在ID为ll2_7的线性布局中dynamic膨胀: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ScrollView android:id="@+id/scrollView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/relLayoutButtonNext" android:layout_below="@id/textView1" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="20dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="10dp" > […]

ScrollView里面的视图并不占用所有的位置

我有一个ScrollView内的RelativeLayout。 我的RelativeLayout有android:layout_height="match_parent"但视图不占用整个大小,就像一个wrap_content。 有没有办法让真正的fill_parent / match_parent行为? 我的布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/top" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:scaleType="fitXY" android:src="@drawable/top" /> <ImageView android:id="@+id/header" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/top" android:scaleType="fitXY" android:src="@drawable/headerbig" /> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/header" android:layout_centerHorizontal="true" android:layout_marginBottom="3dp" android:src="@drawable/logo" /> <ScrollView android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_above="@+id/bottom" android:layout_below="@+id/logo" android:background="@drawable/background" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/dashboard01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/dashboard02" android:layout_centerHorizontal="true" android:layout_marginBottom="30dp" android:src="@drawable/dashboard01" android:visibility="visible" /> […]

align-content和align-items有什么区别?

任何人都可以显示align-items和align-content之间的区别吗? 我很困惑。 谢谢一堆!

你可以做这个HTML布局而不使用表?

好的,一两周前我有一个简单的布局问题。 即一个页面的部分需要一个标题: +———————————————————+ | Title Button | +———————————————————+ 很简单的东西。 事情是表仇恨似乎已经接pipe了networking世界,当我问为什么使用定义列表(DL,DD,DT)为HTML表单而不是表格的标签提醒我时, 先前已经讨论过表格vs div / CSS的主题,例如: DIV与表 ; 和 表格而不是DIV 。 所以这不是一个关于CSS和表格布局的一般性讨论。 这只是一个问题的解决scheme。 我尝试了以上使用CSS的各种解决scheme,包括: 为button浮动或包含button的div; 相对于button的位置; 和 相对位置+绝对位置。 这些解决scheme都不能满足不同的原因。 例如,相对定位导致z-index问题,其中我的下拉菜单出现在内容下。 所以我最终回到: <style type="text/css"> .group-header { background-color: yellow; width: 100%; } .group-header td { padding: 8px; } .group-title { text-align: left; font-weight: bold; } .group-buttons { text-align: right; […]

如何根据父级的维度来确定Android视图的大小

如何根据其父级布局的大小调整视图的大小。 例如,我有一个填充整个屏幕的RelativeLayout ,我想要一个孩子的视图,说一个ImageView ,占据整个高度,宽度的一半? 我已经尝试覆盖所有关于onMeasure , onLayout , onSizeChanged等,我无法得到它的工作….

在Android中以编程方式删除背景绘制

我想以编程方式删除背景可绘制(@ drawable / bg)。 有没有办法做到这一点? 目前,我的布局中有以下XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/widget29" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/bg"> </RelativeLayout>

滚动具有满溢内容的Flexbox

这是我用来实现上述布局的代码 : .header { height: 50px; } .body { position: absolute; top: 50px; right: 0; bottom: 0; left: 0; display: flex; } .sidebar { width: 140px; } .main { flex: 1; display: flex; flex-direction: column; } .content { flex: 1; display: flex; } .column { padding: 20px; border-right: 1px solid #999; } <div class="header">Main header</div> […]

android布局:这个标签及其子元素可以被一个<TextView />和一个复合的drawable所取代

当我在特定的XML文件上运行布局时,我得到这个: This tag and its children can be replaced by one <TextView/> and a compound drawable 对于下面的xml代码应该做什么改变: <LinearLayout android:id="@+id/name_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:background="@drawable/grouplist_single_left_grey_area" > <ImageView android:id="@+id/photo_image" android:layout_width="@dimen/thumbnail_width" android:layout_height="@dimen/thumbnail_height" android:paddingBottom="5dip" android:paddingTop="5dip" android:paddingRight="5dip" android:paddingLeft="5dip" android:layout_marginRight="5dip" android:clickable="true" android:focusable="true" android:scaleType="fitCenter" android:src="@*android:drawable/nopicture_thumbnail" android:background="@drawable/photo_highlight" /> <TextView android:id="@+id/name" android:paddingLeft="5dip" android:layout_weight="1" android:layout_width="0dip" android:layout_height="wrap_content" android:gravity="center_vertical" android:textAppearance="?android:attr/textAppearanceLarge" /> </LinearLayout> 这是它在屏幕上的样子: 相机图标是默认设置。 点击它会让用户select另一个图像。