Tag: 垂直alignment

什么是build议的方式来alignment内存在C + + 11

我正在单个生产者单消费者环形缓冲区实现。我有两个要求: 1)将一个环形缓冲区的一个堆分配实例与一个caching行alignment。 2)将环形缓冲区中的字段与caching行alignment(以防止错误共享)。 我的课程看起来像这样: #define CACHE_LINE_SIZE 64 // To be used later. template<typename T, uint64_t num_events> class RingBuffer { // This needs to be aligned to a cache line. public: …. private: std::atomic<int64_t> publisher_sequence_ ; int64_t cached_consumer_sequence_; T* events_; std::atomic<int64_t> consumer_sequence_; // This needs to be aligned to a cache line. }; 让我先解决点1,即alignment一个单一堆分配的类实例 。 有几种方法: […]

Android:如何alignment上面的底部和listviewbutton?

我想在列表视图的底部有一个button。 如果我使用relativeLayout / FrameLayout,它会alignment,但listView会下降到很低的程度。 (在底部的button后面) 的FrameLayout: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="wrap_content" /> <FrameLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentBottom="true"> <Button android:id="@+id/btnButton" android:text="Hello" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" /> </FrameLayout> </FrameLayout> RelativeLayout的: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ListView android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true"> <Button android:id="@+id/btnButton" android:text="Hello" android:layout_width="match_parent" android:layout_height="wrap_content" […]

Android布局右alignment

我有以下布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="13"> <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <ImageButton android:background="@null" android:id="@+id/back" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/back" android:padding="10dip" /> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <ImageButton android:background="@null" android:id="@+id/forward" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/forward" […]

在div的底部使用CSSalignmentbutton

我想alignment我的div右下angular的button。 我怎样才能做到这一点? div的当前CSS: float: right; width: 83%; margin-right: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; height:625px; overflow:auto;

如何设置UILabel for iOS应用程序的左上alignment方式?

我已经在我的笔尖文件中添加了一个标签,然后需要为该标签左上angularalignment。 由于我在运行时提供文本,所以不知道有多less行。 所以如果文本只包含单行,那么它显示为垂直中心alignment。 这alignment不符合我个人在前面的标签。 例如: 这看起来很奇怪:( 有没有什么办法可以将标签文本设置为左上alignment?

并排alignment<div>元素

我知道这是一个相当简单的问题,但我无法弄清楚我的生活。 我有两个链接,我已经应用了一个背景图像。 这是它目前的样子(对阴影的道歉,只是一个button的粗略草图): 不过,我希望这两个button是并排的。 我不能真正弄清楚需要做什么。 这是HTML <div id="dB"}> <a href="http://notareallink.com" title="Download" id="buyButton">Download</a> </div> <div id="gB"> <a href="#" title="Gallery" onclick="$j('#galleryDiv').toggle('slow');return false;" id="galleryButton">Gallery</a> </div> 这是CSS #buyButton { background: url("assets/buy.png") 0 0 no-repeat; display:block; height:80px; width:232px; text-indent:-9999px; } #buyButton:hover{ width: 232px; height: 80px; background-position: -232px 0; } #buyButton:active { width: 232px; height: 80px; background-position: -464px 0; } #galleryButton […]

使用CSS 3垂直alignment

有了CSS 3,有没有办法垂直alignment一个块元素? 你有没有例子? 谢谢。

如何将页脚(div)alignment到页面的底部?

任何人都可以解释如何alignment页脚底部的页面。 从我见过的例子中,他们都展示了如何让div保持可见,无论你在哪里滚动页面。 虽然我不想那样。 我希望它固定在页面的底部,所以它不会移动。 感谢帮助!

如何dynamic添加使用jQuery文本alignment的样式

我试图纠正常见的IE浏览器错误周围的CSS 2.1,并需要一种方法来改变元素样式属性添加自定义文本alignment样式。 目前在jQuery中,你可以做类似的事情 $(this).width( or $(this).height( 但我似乎无法find一个好方法来改变文本alignmentw /这种相同的方法。 该项目已经有一个类,我没有运气设置在该类的文本alignment。 在定义类之后,是否可以添加一个文本alignmentcss属性? 我有这样的事情 $(this).css("text-align", "center"); 只是在我的宽度调整后,我看到这个在萤火虫中,我看到只有“宽度”是风格上设置的唯一属性…任何帮助? 编辑: 哇 – 在这个问题上的回应很大! 感谢所有回答的人! 关于手头问题的更多细节: 我调整了jqGrid A3.5的js源代码,做了一些自定义的子网格工作,实际的JS调整如下所示(抱歉在上面的例子中使用了“this”,但是我想保持这个简单简洁) var subGridJson = function(sjxml, sbid) { var tbl, trdiv, tddiv, result = "", i, cur, sgmap, dummy = document.createElement("table"); tbl = document.createElement("tbody"); $(dummy).attr({ cellSpacing: "0", cellPadding: "0", border: "0" }); trdiv = document.createElement("tr"); […]

为什么C编译器不能重新排列结构成员来消除alignment填充?

可能重复: 为什么GCC不优化结构? 为什么C ++不使结构更紧密? 考虑在32位x86机器上的以下示例: 由于alignment约束,下面的结构 struct s1 { char a; int b; char c; char d; char e; } 可以更有效地代表内存(12比8字节),如果成员被重新sorting的话 struct s2 { int b; char a; char c; char d; char e; } 我知道C / C ++编译器不允许这样做。 我的问题是为什么语言是这样devise的。 毕竟,我们最终可能会浪费大量的内存, struct_ref->b引用不会关心这个区别。 编辑 :谢谢大家的非常有用的答案。 你很好地解释了为什么重新安排因为devise语言的方式而不起作用。 但是,这让我想:如果重新安排是语言的一部分,这些论据是否仍然会成立? 假设有一些特定的重排规则,我们至less要求这样做 我们应该只在实际需要时重新组织结构(如果结构已经“紧”,不要做任何事情) 该规则仅查看结构的定义,而不是内部结构。 这确保了一个结构types具有相同的布局,而不pipe它是否在另一个结构中是内部的 给定结构的编译内存布局是可预测的,因为它的定义(即规则是固定的) 我一个接一个地说我的理由: 低级数据映射,“最不可思议的元素” :只要你自己写一个简洁的结构(比如@Perry的答案),没有什么变化(需求1)。 如果出于某种奇怪的原因,您希望内部填充在那里,您可以使用虚拟variables手动插入它,和/或可能有关键字/指令。 […]