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


Java FrameLayout.setFocusable方法代码示例

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


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

示例1: initDialog

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    //contentLayout.setFitsSystemWindows(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(false);//触摸屏幕取消窗体
    dialog.setCancelable(false);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:BaseDialog.java

示例2: addStickerTab

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void addStickerTab(TLRPC.Document sticker) {
    final int position = tabCount++;
    FrameLayout tab = new FrameLayout(getContext());
    tab.setFocusable(true);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            delegate.onPageSelected(position);
        }
    });
    tabsContainer.addView(tab);
    tab.setSelected(position == currentPosition);
    BackupImageView imageView = new BackupImageView(getContext());
    if (sticker != null && sticker.thumb != null) {
        imageView.setImage(sticker.thumb.location, null, "webp", null);
    }
    imageView.setAspectFit(true);
    tab.addView(imageView, LayoutHelper.createFrame(30, 30, Gravity.CENTER));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:20,代码来源:ScrollSlidingTabStrip.java

示例3: init

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void init(Context context) {
    contentLayout = new FrameLayout(context);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    dialog = new android.app.Dialog(context);
    dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
    dialog.setCancelable(true);//按返回键取消窗体
    Window window = dialog.getWindow();
    window.setGravity(Gravity.BOTTOM);//位于屏幕底部
    window.setWindowAnimations(R.style.Animation_Popup);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    //android.util.AndroidRuntimeException: requestFeature() must be called before adding content
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setContentView(contentLayout);
}
 
开发者ID:mainh,项目名称:MainCalendar,代码行数:17,代码来源:Popup.java

示例4: initDialog

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
    dialog.setCancelable(true);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:21,代码来源:BasicPopup.java

示例5: TabContentViewParent

import android.widget.FrameLayout; //导入方法依赖的package包/类
public TabContentViewParent(Context context, Tab tab) {
    super(context);
    mInfobarWrapper = new FrameLayout(context);
    mInfobarWrapper.setFocusable(true);
    mInfobarWrapper.setFocusableInTouchMode(true);
    addView(mInfobarWrapper,
            new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    tab.addObserver(mTabObserver);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:10,代码来源:TabContentViewParent.java

示例6: addIconTabWithCounter

import android.widget.FrameLayout; //导入方法依赖的package包/类
public TextView addIconTabWithCounter(int resId) {
    final int position = tabCount++;
    FrameLayout tab = new FrameLayout(getContext());
    tab.setFocusable(true);
    tabsContainer.addView(tab);

    ImageView imageView = new ImageView(getContext());
    imageView.setImageResource(resId);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            delegate.onPageSelected(position);
        }
    });
    tab.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    tab.setSelected(position == currentPosition);

    TextView textView = new TextView(getContext());
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    textView.setTextColor(0xffffffff);
    textView.setGravity(Gravity.CENTER);
    textView.setBackgroundResource(R.drawable.sticker_badge);
    textView.setMinWidth(AndroidUtilities.dp(18));
    textView.setPadding(AndroidUtilities.dp(5), 0, AndroidUtilities.dp(5), AndroidUtilities.dp(1));
    tab.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 18, Gravity.TOP | Gravity.LEFT, 26, 6, 0, 0));

    return textView;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:32,代码来源:ScrollSlidingTabStrip.java

示例7: setParentActivity

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void setParentActivity(Activity activity) {
    if (parentActivity == activity) {
        return;
    }
    parentActivity = activity;

    windowView = new FrameLayout(activity);
    windowView.setFocusable(true);
    windowView.setFocusableInTouchMode(true);
    if (Build.VERSION.SDK_INT >= 23) {
        windowView.setFitsSystemWindows(true);
    }

    containerView = new FrameLayoutDrawer(activity);
    containerView.setFocusable(false);
    windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    containerView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
                close();
            }
            return true;
        }
    });

    windowLayoutParams = new WindowManager.LayoutParams();
    windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.format = PixelFormat.TRANSLUCENT;
    windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.gravity = Gravity.TOP;
    windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
    if (Build.VERSION.SDK_INT >= 21) {
        windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
    } else {
        windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    }
    centerImage.setAspectFit(true);
    centerImage.setInvalidateAll(true);
    centerImage.setParentView(containerView);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:42,代码来源:StickerPreviewViewer.java

示例8: setParentActivity

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void setParentActivity(Activity activity) {
    if (parentActivity == activity) {
        return;
    }
    parentActivity = activity;

    windowView = new FrameLayout(activity);
    windowView.setBackgroundColor(0xff000000);
    windowView.setFocusable(true);
    windowView.setFocusableInTouchMode(true);
    if (Build.VERSION.SDK_INT >= 23) {
        windowView.setFitsSystemWindows(true);
    }

    containerView = new FrameLayoutDrawer(activity);
    containerView.setFocusable(false);
    windowView.addView(containerView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)containerView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
    containerView.setLayoutParams(layoutParams);
    containerView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
                closePhoto();
            }
            return true;
        }
    });

    secretDeleteTimer = new SecretDeleteTimer(activity);
    containerView.addView(secretDeleteTimer);
    layoutParams = (FrameLayout.LayoutParams)secretDeleteTimer.getLayoutParams();
    layoutParams.gravity = Gravity.TOP | Gravity.RIGHT;
    layoutParams.width = AndroidUtilities.dp(100);
    layoutParams.height = AndroidUtilities.dp(32);
    layoutParams.rightMargin = AndroidUtilities.dp(19);
    layoutParams.topMargin = AndroidUtilities.dp(19);
    secretDeleteTimer.setLayoutParams(layoutParams);

    windowLayoutParams = new WindowManager.LayoutParams();
    windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.format = PixelFormat.TRANSLUCENT;
    windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.gravity = Gravity.TOP;
    windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
    windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

    centerImage.setParentView(containerView);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:53,代码来源:SecretPhotoViewer.java

示例9: setParentActivity

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void setParentActivity(Activity activity) {
    if (parentActivity == activity) {
        return;
    }
    parentActivity = activity;

    windowView = new FrameLayout(activity);
    windowView.setBackgroundColor(0xff000000);
    windowView.setFocusable(true);
    windowView.setFocusableInTouchMode(true);
    if (Build.VERSION.SDK_INT >= 23) {
        windowView.setFitsSystemWindows(true); //TODO ?
    }

    containerView = new FrameLayoutDrawer(activity);
    containerView.setFocusable(false);
    windowView.addView(containerView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)containerView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
    containerView.setLayoutParams(layoutParams);
    containerView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
                closePhoto();
            }
            return true;
        }
    });

    secretDeleteTimer = new SecretDeleteTimer(activity);
    containerView.addView(secretDeleteTimer);
    layoutParams = (FrameLayout.LayoutParams)secretDeleteTimer.getLayoutParams();
    layoutParams.gravity = Gravity.TOP | Gravity.RIGHT;
    layoutParams.width = AndroidUtilities.dp(100);
    layoutParams.height = AndroidUtilities.dp(32);
    layoutParams.rightMargin = AndroidUtilities.dp(19);
    layoutParams.topMargin = AndroidUtilities.dp(19);
    secretDeleteTimer.setLayoutParams(layoutParams);

    windowLayoutParams = new WindowManager.LayoutParams();
    windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.format = PixelFormat.TRANSLUCENT;
    windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.gravity = Gravity.TOP;
    windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
    windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

    centerImage.setParentView(containerView);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:53,代码来源:SecretPhotoViewer.java


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