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


Java FrameLayout类代码示例

本文整理汇总了Java中android.widget.FrameLayout的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout类的具体用法?Java FrameLayout怎么用?Java FrameLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setPosition

import android.widget.FrameLayout; //导入依赖的package包/类
@Override
public final void setPosition(@NonNull final Axis axis, @NonNull final AbstractItem item,
                              final float position) {
    ensureNotNull(axis, "The axis may not be null");
    ensureNotNull(item, "The item may not be null");
    View view = item.getView();

    if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
        Toolbar[] toolbars = getTabSwitcher().getToolbars();
        view.setY((getTabSwitcher().areToolbarsShown() && getTabSwitcher().isSwitcherShown() &&
                toolbars != null ?
                toolbars[TabSwitcher.PRIMARY_TOOLBAR_INDEX].getHeight() - tabInset : 0) +
                getTabSwitcherPadding(axis, Gravity.START) + position);
    } else {
        FrameLayout.LayoutParams layoutParams =
                (FrameLayout.LayoutParams) view.getLayoutParams();
        view.setX(position + layoutParams.leftMargin + getTabSwitcher().getPaddingLeft() / 2f -
                getTabSwitcher().getPaddingRight() / 2f -
                (getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE &&
                        getTabSwitcher().isSwitcherShown() ?
                        stackedTabCount * stackedTabSpacing / 2f : 0));
    }
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:24,代码来源:PhoneArithmetics.java

示例2: drawOtherRowOtherCol

import android.widget.FrameLayout; //导入依赖的package包/类
/**
     * 绘制其他行其他列,即每个课程背景格子
     */
    private void drawOtherRowOtherCol(LinearLayout scrollContentView) {
        contentView = new FrameLayout(getContext());
        contentView.setClickable(true);

        LinearLayout.LayoutParams contentViewLP = new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT,
                android.view.ViewGroup.LayoutParams.MATCH_PARENT);
        contentView.setLayoutParams(contentViewLP);
        scrollContentView.addView(contentView);

        for (int i = 0; i < showDaysNum * showJiesNum; i++) {
            final int row = i / showDaysNum;
            final int col = i % showDaysNum;
            // 课程背景格子
            View courseBackView=mAdapter.getCourseBackView();
//            FrameLayout courseBackView = new FrameLayout(getContext());
            FrameLayout.LayoutParams courseBackViewLP = new FrameLayout.LayoutParams(notFirstEveryColumnsWidth,
                    notFirstEveryRowHeight);
//            courseBackView.setBackgroundResource(R.drawable.course_back);
            courseBackViewLP.setMargins(col * notFirstEveryColumnsWidth, row * notFirstEveryRowHeight, 0, 0);
            courseBackView.setLayoutParams(courseBackViewLP);
            contentView.addView(courseBackView);
        }
    }
 
开发者ID:huangshuai-IOT,项目名称:SScheduleView-Android,代码行数:27,代码来源:SScheduleView.java

示例3: onFinishInflate

import android.widget.FrameLayout; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
        super.onFinishInflate();
        menu = (ViewGroup) getChildAt(0);
        View view = getChildAt(getChildCount() - 1);
        if (view instanceof ContentView) {
                content = (ContentView) view;
                LogUtil.e("range" + range);
                LogUtil.e("range1" + getWidth() * 0.8);
                content.setRange((int) (getWidth() * 0.8));
        }
        if (SHADOW) {
                ivShadow = new ImageView(getContext());
                LogUtil.e("这里执行了吗");
                FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                ivShadow.setImageResource(R.drawable.shadow);
                addView(ivShadow, 1, layoutParams);
        }
        menu.setClickable(true);
        content.setClickable(true);
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:22,代码来源:DragLayout.java

示例4: onLoadingState

import android.widget.FrameLayout; //导入依赖的package包/类
/**
 * 加载中
 */
@DoMain
public void onLoadingState() {
    FrameLayout contains = (FrameLayout) findViewById(R.id.state_contains);
    contains.removeAllViews();
    View loading = View.inflate(this, R.layout.view_loading, null);
    contains.addView(loading);
    ImageView loading_img = (ImageView) loading.findViewById(R.id.loading_icon);
    RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setDuration(500);
    rotateAnimation.setRepeatMode(RotateAnimation.RESTART);
    rotateAnimation.setRepeatCount(-1);
    loading_img.setAnimation(rotateAnimation);
}
 
开发者ID:penghongru,项目名称:Coder,代码行数:17,代码来源:StateActivity.java

示例5: PageIndicator

import android.widget.FrameLayout; //导入依赖的package包/类
public PageIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.context = context;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PageIndicator);
    normalIndicator = a.getResourceId(R.styleable.PageIndicator_normal_indicator,
            R.drawable.shape_point_white_alpha);
    selectedIndicator = a.getResourceId(R.styleable.PageIndicator_selected_indicator,
            R.drawable.shape_point_black);
    a.recycle();

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams
            (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    llIndicators = new LinearLayout(context);
    llIndicators.setLayoutParams(params);
    llIndicators.setOrientation(LinearLayout.HORIZONTAL);

    indicator = new ImageView(context);
    FrameLayout.LayoutParams params1 = new FrameLayout.LayoutParams
            (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    indicator.setLayoutParams(params1);
    indicator.setImageResource(selectedIndicator);//默认使用白色实心点

    this.addView(llIndicators);
    this.addView(indicator);


}
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:29,代码来源:PageIndicator.java

示例6: render

import android.widget.FrameLayout; //导入依赖的package包/类
@Override
public View render(final CoachmarkViewLayout layout) {

    if (inflated == null) {
        LayoutInflater inflater = (LayoutInflater) layout.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflated = inflater.inflate(R.layout.dismiss_no_button_view, null);
        layout.addView(inflated);
    }


    inflated.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mListener == null || mListener.onClicked()) {
                layout.dismiss();
            }
        }
    });

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
    inflated.setLayoutParams(params);
    inflated.setVisibility(View.VISIBLE);

    return inflated;

}
 
开发者ID:Kaufland,项目名称:andcoachmark,代码行数:27,代码来源:DismissOnTouchNoButtonRenderer.java

示例7: measure

import android.widget.FrameLayout; //导入依赖的package包/类
@Override
protected MeasureOutput measure(int width, int height) {
  MeasureOutput measureOutput = new MeasureOutput();
  if (this.mOrientation == Constants.Orientation.HORIZONTAL) {
    int screenW = WXViewUtils.getScreenWidth(WXEnvironment.sApplication);
    int weexW = WXViewUtils.getWeexWidth(getInstanceId());
    measureOutput.width = width > (weexW >= screenW ? screenW : weexW) ? FrameLayout.LayoutParams.MATCH_PARENT
                                                                       : width;
    measureOutput.height = height;
  } else {
    int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
    int weexH = WXViewUtils.getWeexHeight(getInstanceId());
    measureOutput.height = height > (weexH >= screenH ? screenH : weexH) ? FrameLayout.LayoutParams.MATCH_PARENT
                                                                         : height;
    measureOutput.width = width;
  }
  return measureOutput;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:19,代码来源:WXScroller.java

示例8: CategoryController

import android.widget.FrameLayout; //导入依赖的package包/类
CategoryController(final Activity activity, LoaderManager loaderManager, View itemView) {
    super(itemView);

    this.activity = activity;
    this.loaderManager = loaderManager;

    appCardsAdapter = new AppPreviewAdapter(activity);

    viewAll = (Button) itemView.findViewById(R.id.button);
    viewAll.setOnClickListener(onViewAll);

    heading = (TextView) itemView.findViewById(R.id.name);
    image = (FeatureImage) itemView.findViewById(R.id.category_image);
    background = (FrameLayout) itemView.findViewById(R.id.category_background);

    RecyclerView appCards = (RecyclerView) itemView.findViewById(R.id.app_cards);
    appCards.setAdapter(appCardsAdapter);
    appCards.addItemDecoration(new ItemDecorator(activity));

    displayImageOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .imageScaleType(ImageScaleType.NONE)
            .displayer(new FadeInBitmapDisplayer(100, true, true, false))
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:27,代码来源:CategoryController.java

示例9: onSetupTabAdapter

import android.widget.FrameLayout; //导入依赖的package包/类
@Override
protected void onSetupTabAdapter(ViewPageFragmentAdapter adapter) {

    FrameLayout generalActionBar = (FrameLayout) mRoot.findViewById(R.id.general_actionbar);
    generalActionBar.setVisibility(View.GONE);

    String[] title = getResources().getStringArray(R.array.events);
    if (position == 0) {
        adapter.addTab(title[0], "new_event", EventFragment.class, getBundle(EventList.EVENT_LIST_TYPE_NEW_EVENT));
        adapter.addTab(title[1], "my_event", EventFragment.class, getBundle(EventList.EVENT_LIST_TYPE_MY_EVENT));
        mTabStrip.setVisibility(View.VISIBLE);
    } else {
        adapter.addTab(title[1], "my_event", EventFragment.class, getBundle(EventList.EVENT_LIST_TYPE_MY_EVENT));
        mTabStrip.setVisibility(View.GONE);
    }
    mViewPager.setCurrentItem(position, true);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:18,代码来源:EventViewPagerFragment.java

示例10: notifyDataSetChanged

import android.widget.FrameLayout; //导入依赖的package包/类
/**
 * 数据更新通知
 */
public void notifyDataSetChanged() {
    int num = getChildCount();
    for (int i = 0; i < num; i++) {
        FrameLayout frameLayout = (FrameLayout) getChildAt(i);
        int tag = Integer.parseInt(frameLayout.getTag().toString());
        if (tag > 0 && tag < adapter.getItemCount()) {
            frameLayout.setVisibility(View.VISIBLE);
            adapter.bindView(frameLayout.getChildAt(0), tag);
        } else {
            frameLayout.setVisibility(View.INVISIBLE);
        }

        if (i == 3 && tag == 0) {
            adapter.displaying(0);
        }
    }
}
 
开发者ID:yangchong211,项目名称:YCCardView,代码行数:21,代码来源:CardViewLayout.java

示例11: setupStatusBarView

import android.widget.FrameLayout; //导入依赖的package包/类
/**
 * 设置一个可以自定义颜色的状态栏
 */
private void setupStatusBarView() {
    if (mBarParams.statusBarView == null) {
        mBarParams.statusBarView = new View(mActivity);
    }
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, getStatusBarHeight(mActivity));
    params.gravity = Gravity.TOP;
    if (!isNavigationAtBottom(mActivity)) {
        params.rightMargin = getNavigationBarWidth(mActivity);
    }
    mBarParams.statusBarView.setLayoutParams(params);
    mBarParams.statusBarView.setBackgroundColor(ColorUtils.blendARGB(mBarParams.statusBarColor,
            mBarParams.statusBarColorTransform, mBarParams.statusBarAlpha));
    mBarParams.statusBarView.setVisibility(View.VISIBLE);
    ViewGroup viewGroup = (ViewGroup) mBarParams.statusBarView.getParent();
    if (viewGroup != null)
        viewGroup.removeView(mBarParams.statusBarView);
    mViewGroup.addView(mBarParams.statusBarView);
}
 
开发者ID:penghongru,项目名称:Coder,代码行数:22,代码来源:ImmersionBar.java

示例12: RecyclerViewScrollbar

import android.widget.FrameLayout; //导入依赖的package包/类
public RecyclerViewScrollbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray ta = context.getTheme().obtainStyledAttributes(attrs, R.styleable.RecyclerViewScrollbar, defStyleAttr, 0);
    mRecyclerViewId = ta.getResourceId(R.styleable.RecyclerViewScrollbar_recyclerView, 0);
    mScrollbarDrawable = ta.getDrawable(R.styleable.RecyclerViewScrollbar_scrollbarDrawable);
    mLetterDrawable = ta.getDrawable(R.styleable.RecyclerViewScrollbar_letterDrawable);
    int letterTextResId = ta.getResourceId(R.styleable.RecyclerViewScrollbar_letterTextAppearance, 0);
    mMinScrollbarHeight = ta.getDimensionPixelOffset(R.styleable.RecyclerViewScrollbar_minScrollbarHeight, 0);
    ta.recycle();

    mLetterView = new TextView(getContext());
    mLetterView.setBackgroundDrawable(mLetterDrawable);
    TextViewCompat.setTextAppearance(mLetterView, letterTextResId);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = GravityCompat.END;
    mLetterView.setLayoutParams(params);
    mLetterView.setGravity(Gravity.CENTER);
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:21,代码来源:RecyclerViewScrollbar.java

示例13: showAlternativeView

import android.widget.FrameLayout; //导入依赖的package包/类
void showAlternativeView(int viewType) {
    FrameLayout recyclerFrame = findViewById(R.id.recycler_frame);
    recyclerFrame.setVisibility(View.GONE);
    mShowCancelAll = false;

    switch (viewType) {
        case ZERO_DOWNLOAD_TYPE:
            ViewStub zeroView = findViewById(R.id.zero_downloads);
            zeroView.setVisibility(View.VISIBLE);
            break;
        case FINISHED_DOWNLOAD_TYPE:
            ViewStub finishedView = findViewById(R.id.finished_downloads);
            finishedView.setVisibility(View.VISIBLE);


            break;
        case CANCELLED_DOWNLOAD_TYPE:
            ViewStub cancelledView = findViewById(R.id.cancelled_downloads);
            cancelledView.setVisibility(View.VISIBLE);
            break;

    }
    new Handler().postDelayed(this::finish, 10000);
}
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:25,代码来源:DownloadProgressActivity.java

示例14: createViews

import android.widget.FrameLayout; //导入依赖的package包/类
@SuppressWarnings({"deprecation", "ResourceType"})
protected void createViews() {
    //Why are we setting a constant as the ID? This should be investigated
    appView.getView().setId(100);
    appView.getView().setLayoutParams(new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    setContentView(appView.getView());

    if (preferences.contains("BackgroundColor")) {
        try {
            int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
            // Background of activity:
            appView.getView().setBackgroundColor(backgroundColor);
        }
        catch (NumberFormatException e){
            e.printStackTrace();
        }
    }

    appView.getView().requestFocusFromTouch();
}
 
开发者ID:SUTFutureCoder,项目名称:localcloud_fe,代码行数:24,代码来源:CordovaActivity.java

示例15: configureCard

import android.widget.FrameLayout; //导入依赖的package包/类
private void configureCard(ViewGroup card) {
    cardContent.setMaxWidth(getCardWidth());
    cardContent.setPadding(
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL,
            CARD_PADDING_VERTICAL,
            CARD_PADDING_HORIZONTAL
    );
    cardContent.setLayoutParams(new FrameLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT
    ));

    card.setBackgroundResource(getCardBackgroundDrawable());
    card.addView(cardContent);

    FrameLayout.LayoutParams cardLayoutParams = generateDefaultLayoutParams();
    cardLayoutParams.width = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.height = LayoutParams.WRAP_CONTENT;
    cardLayoutParams.gravity = getCardGravity();
    cardLayoutParams.leftMargin = getCardMarginLeft();
    cardLayoutParams.topMargin = getCardMarginTop();
    cardLayoutParams.rightMargin = getCardMarginRight();
    cardLayoutParams.bottomMargin = getCardMarginBottom();
    card.setLayoutParams(cardLayoutParams);
}
 
开发者ID:dimorinny,项目名称:show-case-card-view,代码行数:27,代码来源:ShowCaseView.java


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