position

Relative Layout: Different behavior on Api < 11

倖福魔咒の 提交于 2019-12-03 17:00:18
I don't know why, but layout is shown well on device with Api 11+, isn't for older. This is xml: <LinearLayout android:id="@+id/workers_linearlayout" android:layout_width="50dp" android:layout_height="70dp" android:layout_weight="1" > <RelativeLayout android:id="@+id/workers_relative_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:src="@drawable/workers_small" /> <ImageView

Perl - regex - Position of first nonmatching character

安稳与你 提交于 2019-12-03 16:59:05
I want to find the position in a string, where a regular expression stops matching. Simple example: my $x = 'abcdefghijklmnopqrstuvwxyz'; $x =~ /gho/; This example shall give me the position of the character 'h' because 'h' matches and 'o' is the first nonmatching character. I thought of using pos or $- but it is not written on unsuccessful match. Another solution would be to iteratively shorten the regex pattern until it matches but that's very ugly and doesn't work on complex patterns. EDIT: Okay for the linguists: I'm sorry for my awful explanation. To clarify my situation: If you think of

Tricky css/javascript floating task

给你一囗甜甜゛ 提交于 2019-12-03 16:55:35
I have a design that has several divs at varying widths/heights and I need them to float essentially to the top left. A simple css float:left will not work because it does not take advantage of the vertical space once it drops to a new line. I assume I will need to use jQuery to dynamically position each div but I was hoping someone could lead me in the right direction. This is what a standard float left would do: standard float http://www.media1designs.com/poc/superfloat/diagram_float_left.gif This is what I need it to do: what I need http://www.media1designs.com/poc/superfloat/diagram.gif

Simulate mouse clicks at a certain position on inactive window in Java?

两盒软妹~` 提交于 2019-12-03 16:40:31
Anyways, I'm building a bot to run in the background. This bot requires me to click. Of course, I want to be able to do other things while the bot is running. So I was wondering if it was possible for me to simulate a mouse click at a certain position on an inactive window. If this is possible, I would greatly appreciate it if any of you could help me. java.awt.Robot Clicking into an active window is going to activate it, though. 来源: https://stackoverflow.com/questions/6497825/simulate-mouse-clicks-at-a-certain-position-on-inactive-window-in-java

Force nested divs to have min-height of 100%?

倖福魔咒の 提交于 2019-12-03 16:38:37
问题 I know that min-height: 100% will only work to take up a minimum of 100% of its parent element's height if the parent element has some numeric value for height, but what if I have a few nested divs and I want them all to have a min-height of 100%? I tried min-height:inherit but that didn't work either? I know I can probably solve this problem with JavaScript by simply checking the browser height value on document load and then assigning that to the min-height property of my nested divs, but I

Get the position of a fixed div with jquery

≡放荡痞女 提交于 2019-12-03 15:57:24
问题 I have a div with position "fixed" and I want to get the value of its position relative to the whole document while the user scrolls down the page. So, lets say I place the div on (x=0,y=0) and then the user scrolls down a bit and now, relative to the document, the div is on (X=0,y=300). I want to get that information, I want to know the exact position of that div in every moment, again, relative to the whole document, not to the window or the browser. I've tried many things but nothing seems

Unity Editor 编辑器扩展 十 Handle控件

浪子不回头ぞ 提交于 2019-12-03 15:39:54
目录 Handle控件 按钮控制柄窗口 Handle控件 按钮,控制柄,窗口 效果见图: 创建HandleTest.cs脚本,挂载到一个控物体上,然后在Editor文件夹下创建如下脚本: using UnityEngine ; using UnityEditor ; [CustomEditor (typeof(HandleTest))] public class HandleInspector : Editor { int windowID = 1234 ; Rect windowRect ; void OnSceneGUI () { // 1. 物体控制柄 var component = target as HandleTest ; PositionHandle2 (component) ; PositionHandle (component .transform ) ; // 2. 控制按钮 HandleButton () ; // 3. 控制窗口 GUIWindow () ; } void PositionHandle2 (HandleTest component) { var transform = component .transform ; if (Tools .current == Tool .Move ) { transform .rotation =

Unity UI案例(绘制圆环)

倾然丶 夕夏残阳落幕 提交于 2019-12-03 15:36:08
详细设计: 1.饼图的绘制过程: 1.1 获取以某个点为中心,固定半径的圆上的点,再结合原点绘制三角面,可生成扇形; //计算圆上点的位置 Smooth代表圆的光滑程度,也就是饼图被分为多少等份 int Smooth = 100; float perRadian = Matfh.PI * 2 / Smooth;//得到每份所占弧度 然后根据某一块饼图所占的比例计算出它在圆周上相交的点,我们规定从饼图右侧中间位置开始,逆时针方向计算。见图1: //比如绘制19%比例的扇形图 float radius = x;//半径 float startRadian = 0; Vector2 startPoint = new Vector2( radius,0 ); for( int i = 0 ; i * perRadian < 0.19f * Mathf.PI * 2 ; i ++ ) { float endRadian = startRadian + perRadian; Vector2 endPoint = new Vector2(Matfh.Cos(startRadian),Mathf.Sin(endRadian)); startRadian = endRadian; startPoint = endPoint; /

Unity 枚举值在Inspector面板显示中文

浪尽此生 提交于 2019-12-03 15:10:24
Unity 枚举值在Inspector面板显示中文 一般给策划写编辑器时便于策划查看选择类型,将枚举值显示为中文,如下所示 代码如下 using UnityEngine; using System; #if UNITY_EDITOR using UnityEditor; using System.Reflection; using System.Text.RegularExpressions; #endif /// <summary> /// 设置枚举名称 /// </summary> #if UNITY_EDITOR [AttributeUsage(AttributeTargets.Field)] #endif public class EnumAttirbute : PropertyAttribute { /// <summary> /// 枚举名称 /// </summary> public string name; public EnumAttirbute(string name) { this.name = name; } } #if UNITY_EDITOR [CustomPropertyDrawer(typeof(EnumAttirbute))] public class EnumNameDrawer : PropertyDrawer { public

Find position of first value greater than X in a vector [duplicate]

拈花ヽ惹草 提交于 2019-12-03 15:09:33
问题 This question already has an answer here : how to get all the numbers greater than x with positions? (1 answer) Closed last year . In R: I have a vector and want to find the position of the first value that is greater than 100. 回答1: # Randomly generate a suitable vector set.seed(0) v <- sample(50:150, size = 50, replace = TRUE) min(which(v > 100)) 回答2: Most answers based on which and max are slow (especially for long vectors) as they iterate through the entire vector: x>100 evaluates every