当前位置: 首页>>代码示例>>Java>>正文


Java View.getClass方法代码示例

本文整理汇总了Java中android.view.View.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java View.getClass方法的具体用法?Java View.getClass怎么用?Java View.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.getClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSameLayout

import android.view.View; //导入方法依赖的package包/类
/**
 * Tell if two layout view is from the same skin.
 *
 * @param currentView View from <code>ResourceManager.getView() </code> used currently.
 * @param newView     View from <code>ResourceManager.getView() </code> after change skin.
 * @return true if same layout, false otherwise.
 */
public static boolean isSameLayout(View currentView, View newView) {
    if (currentView == newView) {
        return true;
    }
    if (currentView == null || newView == null) {
        return false;
    }
    if (currentView.getClass() != newView.getClass()) {
        return false;
    }
    Object currentTag = currentView.getTag(LAYOUT_TAG_ID);
    Object newTag = newView.getTag(LAYOUT_TAG_ID);
    if (currentTag == newTag) {
        return true;
    }
    if (currentTag == null || newTag == null) {
        return false;
    }
    return currentTag.equals(newTag);
}
 
开发者ID:Zeal27,项目名称:SkinFramework,代码行数:28,代码来源:SkinUtils.java

示例2: getView

import android.view.View; //导入方法依赖的package包/类
/**
 * 返回等于指定class的所有view
 *
 * @param clazz
 * @return
 */
public List<View> getView(Class clazz)
{
    if (clazz == null || mMapView.isEmpty())
    {
        return null;
    }

    List<View> list = new ArrayList<>();
    for (Map.Entry<View, Integer> item : mMapView.entrySet())
    {
        View view = item.getKey();
        if (view != null && view.getClass() == clazz)
        {
            list.add(view);
        }
    }
    return list;
}
 
开发者ID:zj565061763,项目名称:windowmanager,代码行数:25,代码来源:SDWindowManager.java

示例3: getFirstView

import android.view.View; //导入方法依赖的package包/类
/**
 * 返回等于指定class的第一个view
 *
 * @param clazz
 * @return
 */
public View getFirstView(Class clazz)
{
    if (clazz == null || mMapView.isEmpty())
    {
        return null;
    }

    for (Map.Entry<View, Integer> item : mMapView.entrySet())
    {
        View view = item.getKey();
        if (view != null && view.getClass() == clazz)
        {
            return view;
        }
    }
    return null;
}
 
开发者ID:zj565061763,项目名称:windowmanager,代码行数:24,代码来源:SDWindowManager.java

示例4: getResolvedLayoutParams

import android.view.View; //导入方法依赖的package包/类
LayoutParams getResolvedLayoutParams(View child) {
  final LayoutParams result = (LayoutParams) child.getLayoutParams();
  if (!result.mBehaviorResolved) {
    Class<?> childClass = child.getClass();
    DefaultBehavior defaultBehavior = null;
          while (childClass != null &&
                  (defaultBehavior = childClass.getAnnotation(DefaultBehavior.class)) == null) {
      childClass = childClass.getSuperclass();
    }
    if (defaultBehavior != null) {
      try {
                  result.setBehavior(
                          defaultBehavior.value().getDeclaredConstructor().newInstance());
      } catch (Exception e) {
                  Log.e(TAG, "Default behavior class " + defaultBehavior.value().getName() +
                          " could not be instantiated. Did you forget a default constructor?", e);
      }
    }
    result.mBehaviorResolved = true;
  }
  return result;
}
 
开发者ID:commonsguy,项目名称:cwac-crossport,代码行数:23,代码来源:CoordinatorLayout.java

示例5: getResolvedLayoutParams

import android.view.View; //导入方法依赖的package包/类
LayoutParams getResolvedLayoutParams(View child) {
    LayoutParams result = (LayoutParams) child.getLayoutParams();
    if (!result.mBehaviorResolved) {
        DefaultBehavior defaultBehavior = null;
        for (Class<?> childClass = child.getClass(); childClass != null; childClass = childClass.getSuperclass()) {
            defaultBehavior = (DefaultBehavior) childClass.getAnnotation(DefaultBehavior.class);
            if (defaultBehavior != null) {
                break;
            }
        }
        if (defaultBehavior != null) {
            try {
                result.setBehavior((Behavior) defaultBehavior.value().newInstance());
            } catch (Exception e) {
                Log.e(TAG, "Default behavior class " + defaultBehavior.value().getName() + " could not be instantiated. Did you forget a default constructor?", e);
            }
        }
        result.mBehaviorResolved = true;
    }
    return result;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:CoordinatorLayout.java

示例6: tintEdgeEffect

import android.view.View; //导入方法依赖的package包/类
/**
 * Tint the edge effect when you reach the end of a scroll view. API 21+ only
 *
 * @param scrollableView the scrollable view, such as a {@link android.widget.ScrollView}
 * @param color          the color
 * @return true if it worked, false if it did not
 */
@TargetApi(21)
public static boolean tintEdgeEffect(@NonNull View scrollableView, @ColorInt int color) {
    //http://stackoverflow.com/questions/27104521/android-lollipop-scrollview-edge-effect-color
    boolean outcome = false;
    final String[] edgeGlows = {"mEdgeGlowTop", "mEdgeGlowBottom", "mEdgeGlowLeft", "mEdgeGlowRight"};
    for (String edgeGlow : edgeGlows) {
        Class<?> clazz = scrollableView.getClass();
        while (clazz != null) {
            try {
                final Field edgeGlowField = clazz.getDeclaredField(edgeGlow);
                edgeGlowField.setAccessible(true);
                final EdgeEffect edgeEffect = (EdgeEffect) edgeGlowField.get(scrollableView);
                edgeEffect.setColor(color);
                outcome = true;
                break;
            } catch (Exception e) {
                clazz = clazz.getSuperclass();
            }
        }
    }
    return outcome;
}
 
开发者ID:jumaallan,项目名称:AndelaTrackChallenge,代码行数:30,代码来源:Easel.java

示例7: setSearchViewContentColor

import android.view.View; //导入方法依赖的package包/类
public static void setSearchViewContentColor(View searchView, final @ColorInt int color) {
    if (searchView == null) return;
    final Class<?> cls = searchView.getClass();
    try {
        final Field mSearchSrcTextViewField = cls.getDeclaredField("mSearchSrcTextView");
        mSearchSrcTextViewField.setAccessible(true);
        final EditText mSearchSrcTextView = (EditText) mSearchSrcTextViewField.get(searchView);
        mSearchSrcTextView.setTextColor(color);
        mSearchSrcTextView.setHintTextColor(ATEUtil.adjustAlpha(color, 0.5f));
        TintHelper.setCursorTint(mSearchSrcTextView, color);

        Field field = cls.getDeclaredField("mSearchButton");
        tintImageView(searchView, field, color);
        field = cls.getDeclaredField("mGoButton");
        tintImageView(searchView, field, color);
        field = cls.getDeclaredField("mCloseButton");
        tintImageView(searchView, field, color);
        field = cls.getDeclaredField("mVoiceButton");
        tintImageView(searchView, field, color);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:24,代码来源:ToolbarProcessor.java

示例8: findViewWithType

import android.view.View; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T extends View> T findViewWithType(ViewGroup viewGroup, Class<T> clazz) {
    for (int i = 0; i < viewGroup.getChildCount() - 1; i++) {
        View view = viewGroup.getChildAt(i);

        if (view.getClass() == clazz) {
            return (T) view;
        }
    }

    return null;
}
 
开发者ID:dimorinny,项目名称:show-case-card-view,代码行数:13,代码来源:ViewUtils.java

示例9: get

import android.view.View; //导入方法依赖的package包/类
@Nullable
public static StyleHandler get(View view) {
    Class<? extends View> vClazz = view.getClass();
    StyleHandler styleHandler = sAttrHandlerCache.get(vClazz);
    if (styleHandler == null) {
        styleHandler = byClass(vClazz);
        if (styleHandler != null) {
            sAttrHandlerCache.put(vClazz, styleHandler);
        }
    }

    return styleHandler;

}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:15,代码来源:StyleHandlerFactory.java

示例10: process

import android.view.View; //导入方法依赖的package包/类
@Override
public void process(@NonNull Context context, @Nullable String key, @Nullable View target, @Nullable Integer tintColor) {
    if (target == null)
        return;
    if (tintColor == null) {
        // TODO pass a toolbar here?
        final int toolbarColor = Config.toolbarColor(context, key, null);
        tintColor = Config.getToolbarTitleColor(context, null, key, toolbarColor);
    }
    final Class<?> cls = target.getClass();
    try {
        final Field mSearchSrcTextViewField = cls.getDeclaredField("mSearchSrcTextView");
        mSearchSrcTextViewField.setAccessible(true);
        final EditText mSearchSrcTextView = (EditText) mSearchSrcTextViewField.get(target);
        mSearchSrcTextView.setTextColor(tintColor);
        mSearchSrcTextView.setHintTextColor(ContextCompat.getColor(context, ATEUtil.isColorLight(tintColor) ? R.color.ate_text_disabled_dark : R.color.ate_text_disabled_light));
        TintHelper.setCursorTint(mSearchSrcTextView, tintColor);

        Field field = cls.getDeclaredField("mSearchButton");
        tintImageView(target, field, tintColor);
        field = cls.getDeclaredField("mGoButton");
        tintImageView(target, field, tintColor);
        field = cls.getDeclaredField("mCloseButton");
        tintImageView(target, field, tintColor);
        field = cls.getDeclaredField("mVoiceButton");
        tintImageView(target, field, tintColor);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:31,代码来源:SearchViewProcessor.java

示例11: isDecorView

import android.view.View; //导入方法依赖的package包/类
private static boolean isDecorView(@NonNull View view) {
    Class<?> clazz = view.getClass();
    return clazz.getAnnotation(DecorView.class) != null;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:BaseViewPager.java

示例12: isDecorView

import android.view.View; //导入方法依赖的package包/类
private static boolean isDecorView(View view) {
    Class<?> clazz = view.getClass();
    return clazz.getAnnotation(DecorView.class) != null;
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:5,代码来源:YViewPager.java

示例13: isDecorView

import android.view.View; //导入方法依赖的package包/类
private static boolean isDecorView(View view) {
    Class<?> clazz = view.getClass();
    return clazz.getAnnotation(YViewPagerNew.DecorView.class) != null;
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:5,代码来源:YViewPagerNew.java

示例14: isDecorView

import android.view.View; //导入方法依赖的package包/类
private static boolean isDecorView(@NonNull View view) {
    Class<?> clazz = view.getClass();
    return clazz.getAnnotation(YViewPagerOrigin.DecorView.class) != null;
}
 
开发者ID:youngkaaa,项目名称:YViewPagerDemo,代码行数:5,代码来源:YViewPagerOrigin.java

示例15: isDecorView

import android.view.View; //导入方法依赖的package包/类
private static boolean isDecorView(@NonNull View view) {
    Class<?> clazz = view.getClass();
    return clazz.getAnnotation(ViewPager.DecorView.class) != null;
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:5,代码来源:ViewPager.java


注:本文中的android.view.View.getClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。