Update
This commit is contained in:
1 parent
b9f0a6c70c
commit
69330a2fec
20 files changed
+411
-342
No files matched your search
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.hippo.util;
|
||||
|
||||
|
||||
import android.os.Process;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
@@ -45,5 +44,4 @@ public class PriorityThreadFactory implements ThreadFactory {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -350,4 +350,25 @@ public final class ViewUtils {
|
||||
vto.removeOnGlobalLayoutListener(l);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get index in parent
|
||||
*
|
||||
* @param view The view
|
||||
* @return The index
|
||||
*/
|
||||
public static int getIndexInParent(View view) {
|
||||
ViewParent parent = view.getParent();
|
||||
if (parent instanceof ViewGroup) {
|
||||
ViewGroup viewParent = (ViewGroup) parent;
|
||||
int count = viewParent.getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
View v = viewParent.getChildAt(i);
|
||||
if (v == view) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user