當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。