在后台进程中分叉和线程有什么区别?(What is the difference between forking and threading in a background process?)
阅读它所述的spawn gem的文档:
默认情况下,spawn将使用fork来生成子进程。 您可以将其配置为通过在调用时通过告知spawn方法或通过配置环境来执行线程化。 例如,这就是告诉spawn在调用时使用线程的方法,
使用fork或thread之间的区别是什么,这两个决定的影响是什么,以及我如何知道使用哪个?
Reading the documentation for the spawn gem it states:
By default, spawn will use the fork to spawn child processes. You can configure it to do threading either by telling the spawn method when you call it or by configuring your environment. For example, this is how you can tell spawn to use threading on the call,
What would be the difference between using a fork or a thread, what are the repercussions of either decision, and how do I know which to use?
原文:https://stackoverflow.com/questions/10666997
满意答案
用这个:
public YourView(Context context, AttributeSet attrs) { super(context, attrs); int[] set = { android.R.attr.background, // idx 0 android.R.attr.text // idx 1 }; TypedArray a = context.obtainStyledAttributes(attrs, set); Drawable d = a.getDrawable(0); CharSequence t = a.getText(1); Log.d(TAG, "attrs " + d + " " + t); a.recycle(); }
我希望你有一个想法
use this:
public YourView(Context context, AttributeSet attrs) { super(context, attrs); int[] set = { android.R.attr.background, // idx 0 android.R.attr.text // idx 1 }; TypedArray a = context.obtainStyledAttributes(attrs, set); Drawable d = a.getDrawable(0); CharSequence t = a.getText(1); Log.d(TAG, "attrs " + d + " " + t); a.recycle(); }
i hope you got an idea
相关问答
更多Android自定义视图属性 - 不允许使用“颜色”作为属性名称(Android custom view attributes - 'color' as attribute name disallowed)
如何解决:“实现与自定义视图的双向数据绑定时找不到属性'android:text'的getter?(How to solve: “cannot find getter for attribute 'android:text'” when implementing two-way data binding with custom view?)
Android:基于布局的自定义视图:如何?(Android: Custom view based on layout: how?)
Android:自定义视图属性上的选择器(Android: Selector on custom View Attribute)
具有自定义xml属性的自定义视图:如何重新布局布局(Custom View with custom xml attribute: How to refeference a layout)
如何使用标准属性android:文本在我的自定义视图?(How to use standard attribute android:text in my custom view?)
jsp:attribute必须是标准或自定义操作的子元素(jsp:attribute must be the subelement of a standard or custom action)
在我的自定义视图上阅读Android属性(Reading Android attributes on my custom view)
如何在自定义视图中获取android默认属性(How to get android default attributes in a custom view)
下一个视图id作为android中的自定义属性(Next view id as a custom attribute in android)
相关文章
更多干干净净终结进程[转] Terminate process cleanly [reprint]
zz Data Analysis Process
Becoming a data scientist
Hadoop执行分布式Process
multi-core solr deploy process(not complete)
Become a Master Designer: Rule Three: Contrast, Contrast, Contrast
multi-core solr deploy process(not complete)
[转]So You Want To Be A Producer
按钮样式
解决Hadoop抛出的Task process exit with nonzero status of 134异常
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!