當前位置: 首頁>>代碼示例>>Java>>正文


Java LayoutRes類代碼示例

本文整理匯總了Java中android.support.annotation.LayoutRes的典型用法代碼示例。如果您正苦於以下問題:Java LayoutRes類的具體用法?Java LayoutRes怎麽用?Java LayoutRes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LayoutRes類屬於android.support.annotation包,在下文中一共展示了LayoutRes類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: VariableViewAdapter

import android.support.annotation.LayoutRes; //導入依賴的package包/類
/**
 * @param variableNameManager The name manager containing the variables.
 * @param context A context for inflating layouts.
 * @param resource The {@link TextView} layout to use when inflating items.
 */
public VariableViewAdapter(Context context, NameManager variableNameManager,
                           @LayoutRes int resource) {
    super(context, resource);

    mVariableNameManager = variableNameManager;
    mVars = mVariableNameManager.getUsedNames();

    mRenameString = context.getString(R.string.rename_variable);
    mDeleteString = context.getString(R.string.delete_variable);
    refreshVariables();
    variableNameManager.registerObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            refreshVariables();
        }
    });
}
 
開發者ID:Axe-Ishmael,項目名稱:Blockly,代碼行數:23,代碼來源:BasicFieldVariableView.java

示例2: FirebaseRecyclerAdapter

import android.support.annotation.LayoutRes; //導入依賴的package包/類
FirebaseRecyclerAdapter(Class<T> modelClass,
                        @LayoutRes int modelLayout,
                        Class<VH> viewHolderClass,
                        FirebaseArray snapshots) {
    mModelClass = modelClass;
    mModelLayout = modelLayout;
    mViewHolderClass = viewHolderClass;
    mSnapshots = snapshots;

    mSnapshots.setOnChangedListener(new ChangeEventListener() {
        @Override
        public void onChildChanged(EventType type, int index, int oldIndex) {
            FirebaseRecyclerAdapter.this.onChildChanged(type, index, oldIndex);
        }

        @Override
        public void onDataChanged() {
            FirebaseRecyclerAdapter.this.onDataChanged();
        }

        @Override
        public void onCancelled(DatabaseError error) {
            FirebaseRecyclerAdapter.this.onCancelled(error);
        }
    });
}
 
開發者ID:rumaan,項目名稱:AcademApp,代碼行數:27,代碼來源:FirebaseRecyclerAdapter.java

示例3: CommonAdapter

import android.support.annotation.LayoutRes; //導入依賴的package包/類
public CommonAdapter(Context context, Class<? extends T> clazz, @LayoutRes final int layoutId,final int maxRecyclerCount) {
    super();
    mContext = context;
    this.layoutId = layoutId;
    register(clazz, new MultiItemView<T>() {

        @NonNull
        @Override
        public int getLayoutId() {
            return layoutId;
        }

        @Override
        public void onBindViewHolder(@NonNull ViewHolder holder, @NonNull T item, int position) {
            convert(holder, item, position);
        }

        @Override
        public int getMaxRecycleCount() {
            return maxRecyclerCount;
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:CommonAdapter.java

示例4: showCustomLongSafe

import android.support.annotation.LayoutRes; //導入依賴的package包/類
/**
 * 安全地顯示長時自定義吐司
 */
public static void showCustomLongSafe(@LayoutRes final int layoutId) {
    sHandler.post(new Runnable() {
        @Override
        public void run() {
            setView(layoutId);
            show("", Toast.LENGTH_LONG);
        }
    });
}
 
開發者ID:gaolhjy,項目名稱:cniao5,代碼行數:13,代碼來源:ToastUtils.java

示例5: SectionedFirebaseRecyclerAdapter

import android.support.annotation.LayoutRes; //導入依賴的package包/類
/**
 *
 * @param modelClass  the class of the list items
 * @param itemLayout  XML layout of each list item
 * @param itemHolderClass  ViewHolder subclass of the list item
 * @param headerLayout  XML layout of the section headers
 * @param headerHolderClass  ViewHolder subclass of the section headers
 * @param q reference to the Firebase datasource
 */
SectionedFirebaseRecyclerAdapter(Class<T> modelClass,
                                 @LayoutRes int itemLayout,
                                 Class<VH> itemHolderClass,
                                 @LayoutRes int headerLayout,
                                 Class<HVH> headerHolderClass,
                                 Query q) {
    super(modelClass, itemLayout,
            (Class<RecyclerView.ViewHolder>) itemHolderClass, q);
    this.itemLayout = itemLayout;
    this.headerLayout = headerLayout;
    this.itemClass = itemHolderClass;
    this.headerClass = headerHolderClass;
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:23,代碼來源:SectionedFirebaseRecyclerAdapter.java

示例6: QariAdapter

import android.support.annotation.LayoutRes; //導入依賴的package包/類
QariAdapter(@NonNull Context context,
            @NonNull List<QariItem> items,
            @LayoutRes int layoutViewId,
            @LayoutRes int dropDownViewId) {
  mItems = items;
  mLayoutViewId = layoutViewId;
  mDropDownViewId = dropDownViewId;
  mInflater = LayoutInflater.from(context);
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:10,代碼來源:AudioStatusBar.java

示例7: inflateCustomView

import android.support.annotation.LayoutRes; //導入依賴的package包/類
/**
 * Inflates custom view
 *
 * @param layout              layout for custom view
 * @param viewInflateListener inflate listener for custom view
 */
private void inflateCustomView(@LayoutRes int layout, OnViewInflateListener viewInflateListener) {
    View view = mActivity.getLayoutInflater().inflate(layout, this, false);
    this.addView(view);
    if (viewInflateListener != null) {
        viewInflateListener.onViewInflated(view);
    }
}
 
開發者ID:faruktoptas,項目名稱:FancyShowCaseView,代碼行數:14,代碼來源:FancyShowCaseView.java

示例8: getLayout

import android.support.annotation.LayoutRes; //導入依賴的package包/類
@Override
public XmlResourceParser getLayout(@LayoutRes int id) throws NotFoundException {
    int realId = getCorrespondResIdStrictly(id);
    if (realId > 0) {
        return mSkinResources.getLayout(realId);
    }
    return super.getLayout(id);
}
 
開發者ID:Zeal27,項目名稱:SkinFramework,代碼行數:9,代碼來源:ComposedResources.java

示例9: setContentView

import android.support.annotation.LayoutRes; //導入依賴的package包/類
@Override
public void setContentView(@LayoutRes int layoutResID) {
    super.setContentView(layoutResID);
    ButterKnife.bind(this);
    mediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);
    shortAnimationDuration = getResources().getInteger(
            android.R.integer.config_shortAnimTime);
    initViews();
}
 
開發者ID:ehsunshine,項目名稱:memory-game,代碼行數:11,代碼來源:BaseActivity.java

示例10: setContentView

import android.support.annotation.LayoutRes; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void setContentView(@LayoutRes final int layoutResID) {
    super.setContentView(layoutResID);
    if (mFoundViews != null) {
        mFoundViews.clear();
    }
    mFoundViews = AnnotationParser.parseFields(getContext(), this, this);
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:12,代碼來源:ParsableDialog.java

示例11: setRefreshHeaderView

import android.support.annotation.LayoutRes; //導入依賴的package包/類
/**
 * 添加刷新header layout
 * @param refreshHeaderLayoutRes
 */
public void setRefreshHeaderView(@LayoutRes int refreshHeaderLayoutRes) {
    ensureRefreshHeaderContainer();
    final View refreshHeader = LayoutInflater.from(getContext()).inflate(refreshHeaderLayoutRes, mRefreshHeaderContainer, false);
    if (refreshHeader != null) {
        setRefreshHeaderView(refreshHeader);
    }
}
 
開發者ID:ynztlxdeai,項目名稱:MVPtemplate,代碼行數:12,代碼來源:IRecyclerView.java

示例12: setEmptyView

import android.support.annotation.LayoutRes; //導入依賴的package包/類
private void setEmptyView(@LayoutRes final int emptyResourceId) {
    if (mEmptyView == null && emptyResourceId > 0) {
        mEmptyId = emptyResourceId;
        mEmpty.setLayoutResource(emptyResourceId);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            mEmpty.setLayoutInflater(inflater);
        }
        mEmptyView = mEmpty.inflate();
    } else {
        Log.d(VIEW_LOG_TAG, "unabled to set empty view because the empty has been set");
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:UltimateRecyclerView.java

示例13: PlaylistAdapter

import android.support.annotation.LayoutRes; //導入依賴的package包/類
public PlaylistAdapter(AppCompatActivity activity, ArrayList<Playlist> dataSet, @LayoutRes int itemLayoutRes, @Nullable CabHolder cabHolder) {
    super(activity, cabHolder, R.menu.menu_playlists_selection);
    this.activity = activity;
    this.dataSet = dataSet;
    this.itemLayoutRes = itemLayoutRes;
    setHasStableIds(true);
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:8,代碼來源:PlaylistAdapter.java

示例14: RecyclerViewAdapter

import android.support.annotation.LayoutRes; //導入依賴的package包/類
public RecyclerViewAdapter(Context context, List<T> dataList
        , @LayoutRes int layoutId, RecyclerViewSingleTypeProcessor singleTypeProcessor) {
    mContext = context;
    mDataList = dataList;
    mTypeLayoutIds = new ArrayMap<>();
    mTypeLayoutIds.put(0, layoutId);
    mSingleTypeProcessor = singleTypeProcessor;
}
 
開發者ID:arjinmc,項目名稱:ExpandRecyclerView,代碼行數:9,代碼來源:RecyclerViewAdapter.java

示例15: addView

import android.support.annotation.LayoutRes; //導入依賴的package包/類
/**
 * 為snackbar添加布局
 * <p>在show...Snackbar之後調用</p>
 *
 * @param layoutId 布局文件
 * @param index    位置(the position at which to add the child or -1 to add last)
 */
public static void addView(@LayoutRes int layoutId, int index) {
    Snackbar snackbar = snackbarWeakReference.get();
    if (snackbar != null) {
        View view = snackbar.getView();
        Snackbar.SnackbarLayout layout = (Snackbar.SnackbarLayout) view;
        View child = LayoutInflater.from(view.getContext()).inflate(layoutId, null);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.CENTER_VERTICAL;
        layout.addView(child, index, params);
    }
}
 
開發者ID:hoangkien0705,項目名稱:Android-UtilCode,代碼行數:21,代碼來源:SnackbarUtils.java


注:本文中的android.support.annotation.LayoutRes類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。