本文整理汇总了Java中android.view.ViewGroup.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.getId方法的具体用法?Java ViewGroup.getId怎么用?Java ViewGroup.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startUpdate
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void startUpdate(ViewGroup container) {
if (container.getId() == View.NO_ID) {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}
示例2: startUpdate
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void startUpdate(ViewGroup container) {
if (container.getId() == View.NO_ID) {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}
示例3: add
import android.view.ViewGroup; //导入方法依赖的package包/类
/**
* Adds a new view onto the stack. This will add it to the container specified. Only containers that
* are lower or equal position in the view hierarchy as the default container are allowed.
* Views that aren't at the top of the stack will non-clickable.
* @param viewCreator The view creator for the new view
* @param container The container to add the view to
*/
public void add(ViewCreator viewCreator, ViewGroup container){
if (container.getId() == -1){
throw new RuntimeException("Container must have an id set");
}
if (!s.allowDuplicates && checkForDuplicates(viewCreator)){
return;
}
BackStackNode backStackNode = new BackStackNode(viewCreator, container.getId());
final ViewGroup tempView = currentView;
final BackStackNode tempNode = s.nodeStack.peek();
disable(tempView);
s.nodeStack.add(backStackNode);
currentView = addView(backStackNode);
removeView(tempNode, tempView);
}
示例4: buildLinearBackStack
import android.view.ViewGroup; //导入方法依赖的package包/类
private LinearBackStack buildLinearBackStack(String TAG, ViewGroup container, ViewGroup currentView, ViewCreator viewCreator, boolean shouldRetain, boolean allowDuplicates){
LinearBackStack.State state = linearStateMap.get(TAG);
if (state == null){
BackStackNode backStackNode = new BackStackNode(viewCreator, container.getId(), shouldRetain);
state = new LinearBackStack.State(TAG, backStackNode);
state.allowDuplicates = allowDuplicates;
linearStateMap.put(TAG, state);
//
}
LinearBackStack linearBackStack = new LinearBackStack(state, container, activity);
if (currentView == null){
linearBackStack.init();
} else {
if (state.nodeStack.size() != 1 && !shouldRetain){
container.removeView(currentView);
}
linearBackStack.initWithoutFirst(currentView);
}
backStackMap.put(TAG, linearBackStack);
setDefaultRootBackStack(TAG);
return linearBackStack;
}
示例5: findTargetTagAndCoordinatesForTouch
import android.view.ViewGroup; //导入方法依赖的package包/类
/**
* Find touch event target view within the provided container given the coordinates provided
* via {@link MotionEvent}.
*
* @param eventX the X screen coordinate of the touch location
* @param eventY the Y screen coordinate of the touch location
* @param viewGroup the container view to traverse
* @param viewCoords an out parameter that will return the X,Y value in the target view
* @param nativeViewTag an out parameter that will return the native view id
* @return the react tag ID of the child view that should handle the event
*/
public static int findTargetTagAndCoordinatesForTouch(
float eventX,
float eventY,
ViewGroup viewGroup,
float[] viewCoords,
@Nullable int[] nativeViewTag) {
UiThreadUtil.assertOnUiThread();
int targetTag = viewGroup.getId();
// Store eventCoords in array so that they are modified to be relative to the targetView found.
viewCoords[0] = eventX;
viewCoords[1] = eventY;
View nativeTargetView = findTouchTargetView(viewCoords, viewGroup);
if (nativeTargetView != null) {
View reactTargetView = findClosestReactAncestor(nativeTargetView);
if (reactTargetView != null) {
if (nativeViewTag != null) {
nativeViewTag[0] = reactTargetView.getId();
}
targetTag = getTouchTargetForView(reactTargetView, viewCoords[0], viewCoords[1]);
}
}
return targetTag;
}
示例6: onItemClicked
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void onItemClicked(ViewGroup parent, View view, int position) {
switch (parent.getId()) {
case R.id.recycler_view_similar:
Media media = mSimilarList.get(position);
if (media != null && getActivity() != null && getActivity().getSupportFragmentManager() != null) {
getActivity().getSupportFragmentManager()
.beginTransaction()
.replace(R.id.layout_outlet, TVShowDetailsFragment.newInstance(media.getId(), media.getName()))
.commit();
mCallbacks.scrollToTop();
}
break;
case R.id.recycler_view_seasons:
//TODO: Handle this in future release
break;
}
}
示例7: addRootViewGroup
import android.view.ViewGroup; //导入方法依赖的package包/类
protected final void addRootViewGroup(
int tag,
ViewGroup view,
ThemedReactContext themedContext) {
UiThreadUtil.assertOnUiThread();
if (view.getId() != View.NO_ID) {
throw new IllegalViewOperationException(
"Trying to add a root view with an explicit id already set. React Native uses " +
"the id field to track react tags and will overwrite this field. If that is fine, " +
"explicitly overwrite the id field to View.NO_ID before calling addMeasuredRootView.");
}
mTagsToViews.put(tag, view);
mTagsToViewManagers.put(tag, mRootViewManager);
mRootTags.put(tag, true);
view.setId(tag);
}
示例8: startUpdate
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void startUpdate(@NonNull ViewGroup container) {
if (container.getId() == View.NO_ID) {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}
示例9: findContentLayout
import android.view.ViewGroup; //导入方法依赖的package包/类
private ViewGroup findContentLayout(ViewGroup parent) {
if (parent == null) {
return null;
}
if (parent.getId() != android.R.id.content) {
return findContentLayout((ViewGroup) parent.getParent());
} else {
return parent;
}
}
示例10: instantiateItem
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
if (currTransaction == null) {
currTransaction = fm.beginTransaction();
}
Fragment fragment = getExistingFragment(position);
if (fragment != null) {
if (fragment.getId() == container.getId()) {
retentionStrategy.attach(fragment, currTransaction);
} else {
fm.beginTransaction().remove(fragment).commit();
fm.executePendingTransactions();
currTransaction.add(container.getId(), fragment,
getFragmentTag(position));
}
} else {
fragment = createFragment(entries.get(position).getDescriptor());
currTransaction.add(container.getId(), fragment,
getFragmentTag(position));
}
if (fragment != currPrimaryItem) {
fragment.setMenuVisibility(false);
fragment.setUserVisibleHint(false);
}
return fragment;
}
示例11: setContainer
import android.view.ViewGroup; //导入方法依赖的package包/类
/**
* Sets the parent container for the new view. The parent
* @param container
* @return
*/
public Builder setContainer(ViewGroup container){
if (container.getId() == -1){
throw new RuntimeException("Parent Container must have id set");
}
containerId = container.getId();
return this;
}
示例12: startUpdate
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void startUpdate(ViewGroup container) {
final int containerId = container.getId();
if (containerId != View.NO_ID) {
mContainerId = container.getId();
} else {
throw new IllegalStateException("ViewPager with adapter " + this
+ " requires a view id");
}
}
示例13: onItemClicked
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void onItemClicked(ViewGroup parent, View view, int position) {
switch (parent.getId()) {
case R.id.recycler_view_similar:
Media media = mSimilarList.get(position);
if (media != null && getActivity() != null && getActivity().getSupportFragmentManager() != null) {
getActivity().getSupportFragmentManager()
.beginTransaction()
.replace(R.id.layout_outlet, MovieDetailsFragment.newInstance(media.getId(), media.getTitle()))
.commit();
mCallbacks.scrollToTop();
}
break;
}
}
示例14: onInterceptTouchEvent
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public boolean onInterceptTouchEvent(ViewGroup v, MotionEvent event) {
int currentJSResponder = mCurrentJSResponder;
if (currentJSResponder != JS_RESPONDER_UNSET && event.getAction() != MotionEvent.ACTION_UP) {
// Don't intercept ACTION_UP events. If we return true here than UP event will not be
// delivered. That is because intercepted touch events are converted into CANCEL events
// and make all further events to be delivered to the view that intercepted the event.
// Therefore since "UP" event is the last event in a gesture, we should just let it reach the
// original target that is a child view of {@param v}.
// http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent)
return v.getId() == currentJSResponder;
}
return false;
}
示例15: setBarVisible
import android.view.ViewGroup; //导入方法依赖的package包/类
protected void setBarVisible(ViewGroup barLayout, boolean visible) {
if (barLayout.getId() == R.id.document__fragment__edit__textmodule_actions_bar && barLayout.getParent() instanceof HorizontalScrollView) {
((HorizontalScrollView) barLayout.getParent())
.setVisibility(visible ? View.VISIBLE : View.GONE);
}
}