android.widget.FrameLayout#setId ( )源码实例Demo

下面列出了android.widget.FrameLayout#setId ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MiBandDecompiled   文件: ListFragment.java
public View onCreateView(LayoutInflater layoutinflater, ViewGroup viewgroup, Bundle bundle)
{
    FragmentActivity fragmentactivity = getActivity();
    FrameLayout framelayout = new FrameLayout(fragmentactivity);
    LinearLayout linearlayout = new LinearLayout(fragmentactivity);
    linearlayout.setId(0xff0002);
    linearlayout.setOrientation(1);
    linearlayout.setVisibility(8);
    linearlayout.setGravity(17);
    linearlayout.addView(new ProgressBar(fragmentactivity, null, 0x101007a), new android.widget.FrameLayout.LayoutParams(-2, -2));
    framelayout.addView(linearlayout, new android.widget.FrameLayout.LayoutParams(-1, -1));
    FrameLayout framelayout1 = new FrameLayout(fragmentactivity);
    framelayout1.setId(0xff0003);
    TextView textview = new TextView(getActivity());
    textview.setId(0xff0001);
    textview.setGravity(17);
    framelayout1.addView(textview, new android.widget.FrameLayout.LayoutParams(-1, -1));
    ListView listview = new ListView(getActivity());
    listview.setId(0x102000a);
    listview.setDrawSelectorOnTop(false);
    framelayout1.addView(listview, new android.widget.FrameLayout.LayoutParams(-1, -1));
    framelayout.addView(framelayout1, new android.widget.FrameLayout.LayoutParams(-1, -1));
    framelayout.setLayoutParams(new android.widget.FrameLayout.LayoutParams(-1, -1));
    return framelayout;
}
 
源代码2 项目: scene   文件: Case5Scene.java
@NonNull
@Override
public ViewGroup onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    LinearLayout layout = new LinearLayout(getActivity());
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setBackgroundColor(Color.BLACK);

    FrameLayout frameLayout0 = new FrameLayout(requireActivity());
    frameLayout0.setId(ID_0);
    layout.addView(frameLayout0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 100));

    FrameLayout frameLayout1 = new FrameLayout(requireActivity());
    frameLayout1.setId(ID_1);
    layout.addView(frameLayout1, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 100));

    layout.setFitsSystemWindows(true);
    return layout;
}
 
源代码3 项目: glide-support   文件: TestActivity.java
@Override protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	FrameLayout layout = new FrameLayout(this);
	layout.setId(android.R.id.content);
	layout.setLayoutParams(
			new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
	setContentView(layout);

	if (savedInstanceState == null) {
		clearCacheSyncAndHackNetwork();
		getSupportFragmentManager()
				.beginTransaction()
				.add(android.R.id.content, new ListFragment())
				.commit();
	}
}
 
源代码4 项目: MiBandDecompiled   文件: FragmentTabHost.java
private void a(Context context, AttributeSet attributeset)
{
    TypedArray typedarray = context.obtainStyledAttributes(attributeset, new int[] {
        0x10100f3
    }, 0, 0);
    e = typedarray.getResourceId(0, 0);
    typedarray.recycle();
    super.setOnTabChangedListener(this);
    if (findViewById(0x1020013) == null)
    {
        LinearLayout linearlayout = new LinearLayout(context);
        linearlayout.setOrientation(1);
        addView(linearlayout, new android.widget.FrameLayout.LayoutParams(-1, -1));
        TabWidget tabwidget = new TabWidget(context);
        tabwidget.setId(0x1020013);
        tabwidget.setOrientation(0);
        linearlayout.addView(tabwidget, new android.widget.LinearLayout.LayoutParams(-1, -2, 0.0F));
        FrameLayout framelayout = new FrameLayout(context);
        framelayout.setId(0x1020011);
        linearlayout.addView(framelayout, new android.widget.LinearLayout.LayoutParams(0, 0, 0.0F));
        FrameLayout framelayout1 = new FrameLayout(context);
        b = framelayout1;
        b.setId(e);
        linearlayout.addView(framelayout1, new android.widget.LinearLayout.LayoutParams(-1, 0, 1.0F));
    }
}
 
/**
 * 初始化 PullToNextEntity实体
 *
 * @param frameLayoutId
 * @return
 */
public PullToNextEntity newPullToNextView(int frameLayoutId) {


    PullToNextEntity entity = new PullToNextEntity();
    PullToNextView pullToNextView = new PullToNextView(getContext());
    FrameLayout frameLayout = new FrameLayout(getContext());
    frameLayout.setId(frameLayoutId);
    pullToNextView.setContentView(frameLayout);
    pullToNextView.setPullToNextI(mPullToNextI);
    pullToNextView.setTag(frameLayoutId);
    entity.setContentId(frameLayoutId);
    entity.setPullToNextView(pullToNextView);
    return entity;
}
 
源代码6 项目: scene   文件: TestAppCompatActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    setTheme(R.style.Theme_AppCompat);
    super.onCreate(savedInstanceState);
    mFrameLayout = new FrameLayout(this);
    mFrameLayout.setId(ViewIdGenerator.generateViewId());
    setContentView(mFrameLayout);
}
 
源代码7 项目: adt-leanback-support   文件: FragmentTabHost.java
private void ensureHierarchy(Context context) {
    // If owner hasn't made its own view hierarchy, then as a convenience
    // we will construct a standard one here.
    if (findViewById(android.R.id.tabs) == null) {
        LinearLayout ll = new LinearLayout(context);
        ll.setOrientation(LinearLayout.VERTICAL);
        addView(ll, new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        TabWidget tw = new TabWidget(context);
        tw.setId(android.R.id.tabs);
        tw.setOrientation(TabWidget.HORIZONTAL);
        ll.addView(tw, new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0));

        FrameLayout fl = new FrameLayout(context);
        fl.setId(android.R.id.tabcontent);
        ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0));

        mRealTabContent = fl = new FrameLayout(context);
        mRealTabContent.setId(mContainerId);
        ll.addView(fl, new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FILL_PARENT, 0, 1));
    }
}
 
源代码8 项目: BaseUIFrame   文件: BaseFragmentActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    QMUIStatusBarHelper.translucent(this);
    mFragmentContainer = new FrameLayout(this);
    mFragmentContainer.setId(getContextViewId());
    setContentView(mFragmentContainer);
}
 
源代码9 项目: AgentWebX5   文件: TwinklingRefreshLayout.java
private void addHeader() {
    FrameLayout headViewLayout = new FrameLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, 0);
    layoutParams.addRule(ALIGN_PARENT_TOP);

    FrameLayout extraHeadLayout = new FrameLayout(getContext());
    extraHeadLayout.setId(R.id.ex_header);
    LayoutParams layoutParams2 = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    this.addView(extraHeadLayout, layoutParams2);
    this.addView(headViewLayout, layoutParams);

    mExtraHeadLayout = extraHeadLayout;
    mHeadLayout = headViewLayout;

    if (mHeadView == null) {
        if (!TextUtils.isEmpty(HEADER_CLASS_NAME)) {
            try {
                Class headClazz = Class.forName(HEADER_CLASS_NAME);
                Constructor ct = headClazz.getDeclaredConstructor(Context.class);
                setHeaderView((IHeaderView) ct.newInstance(getContext()));
            } catch (Exception e) {
                Log.e("TwinklingRefreshLayout:", "setDefaultHeader classname=" + e.getMessage());
                setHeaderView(new GoogleDotView(getContext()));
            }
        } else {
            setHeaderView(new GoogleDotView(getContext()));
        }
    }
}
 
源代码10 项目: FragmentStack   文件: RootActivity.java
@Override
protected final void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FrameLayout frameLayout = new FrameLayout(this);
    frameLayout.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    frameLayout.setId(R.id.framLayoutId);
    setContentView(frameLayout);
    RootFragment fragment = getRootFragment();
    manager = new StackManager(this);
    manager.setFragment(fragment);
    onCreateNow(savedInstanceState);
}
 
源代码11 项目: scene   文件: SaveAndRestoreTests.java
@NonNull
@Override
public ViewGroup onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container, @Nullable Bundle savedInstanceState) {
    FrameLayout layout = new FrameLayout(requireSceneContext());
    layout.setId(id);
    return layout;
}
 
源代码12 项目: NetEasyNews   文件: FragmentTabHost.java
private void ensureHierarchy(Context context) {
    // If owner hasn't made its own view hierarchy, then as a convenience
    // we will construct a standard one here.
    if (findViewById(android.R.id.tabs) == null) {
        LinearLayout ll = new LinearLayout(context);
        ll.setOrientation(LinearLayout.VERTICAL);
        addView(ll, new LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        TabWidget tw = new TabWidget(context);
        tw.setId(android.R.id.tabs);
        tw.setOrientation(TabWidget.HORIZONTAL);
        ll.addView(tw, new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0));

        FrameLayout fl = new FrameLayout(context);
        fl.setId(android.R.id.tabcontent);
        ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0));

        mRealTabContent = fl = new FrameLayout(context);
        mRealTabContent.setId(mContainerId);
        ll.addView(fl, new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT, 0, 1));
    }
}
 
源代码13 项目: APDE   文件: PreviewActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	frame = new FrameLayout(this);
	frame.setId(CompatUtils.getUniqueViewId());
	setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
			ViewGroup.LayoutParams.MATCH_PARENT));
	
	// We receive a message when a new sketch is going to be loaded
	// We need to finish the activity so that it can be recreated for the new sketch
	broadcastReceiver = new BroadcastReceiver() {
		@Override
		public void onReceive(Context context, Intent intent) {
			if (intent.getAction() != null && intent.getAction().equals("com.calsignlabs.apde.STOP_SKETCH_PREVIEW")) {
				finish();
			}
		}
	};
	
	registerReceiver(broadcastReceiver, new IntentFilter("com.calsignlabs.apde.STOP_SKETCH_PREVIEW"));
	
	if (getIntent().getAction() != null && getIntent().getAction().equals("com.calsignlabs.apde.RUN_SKETCH_PREVIEW")) {
		init();
	} else {
		// Automatically close - this shouldn't ever happen
		finish();
	}
}
 
源代码14 项目: guideshow   文件: FragmentTabHost.java
private void ensureHierarchy(Context context) {
    // If owner hasn't made its own view hierarchy, then as a convenience
    // we will construct a standard one here.
    if (findViewById(android.R.id.tabs) == null) {
        LinearLayout ll = new LinearLayout(context);
        ll.setOrientation(LinearLayout.VERTICAL);
        addView(ll, new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.FILL_PARENT));

        TabWidget tw = new TabWidget(context);
        tw.setId(android.R.id.tabs);
        tw.setOrientation(TabWidget.HORIZONTAL);
        ll.addView(tw, new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT, 0));

        FrameLayout fl = new FrameLayout(context);
        fl.setId(android.R.id.tabcontent);
        ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0));

        mRealTabContent = fl = new FrameLayout(context);
        mRealTabContent.setId(mContainerId);
        ll.addView(fl, new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FILL_PARENT, 0, 1));
    }
}
 
源代码15 项目: ALLGO   文件: ExpandableListItemAdapter.java
private void init() {
	setOrientation(VERTICAL);

	mTitleViewGroup = new FrameLayout(getContext());
	mTitleViewGroup.setId(DEFAULTTITLEPARENTRESID);
	addView(mTitleViewGroup);

	mContentViewGroup = new FrameLayout(getContext());
	mContentViewGroup.setId(DEFAULTCONTENTPARENTRESID);
	addView(mContentViewGroup);
}
 
源代码16 项目: labelview   文件: LabelView.java
private boolean replaceLayout(View target) {
    if (getParent() != null || target == null || target.getParent() == null || _labelViewContainerID != -1) {
        return false;
    }

    ViewGroup parentContainer = (ViewGroup) target.getParent();

    if (target.getParent() instanceof FrameLayout) {
        ((FrameLayout) target.getParent()).addView(this);
    } else if (target.getParent() instanceof ViewGroup) {

        int groupIndex = parentContainer.indexOfChild(target);
        _labelViewContainerID = generateViewId();

        // relativeLayout need copy rule
        if (target.getParent() instanceof RelativeLayout) {
            for (int i = 0; i < parentContainer.getChildCount(); i++) {
                if (i == groupIndex) {
                    continue;
                }
                View view = parentContainer.getChildAt(i);
                RelativeLayout.LayoutParams para = (RelativeLayout.LayoutParams) view.getLayoutParams();
                for (int j = 0; j < para.getRules().length; j++) {
                    if (para.getRules()[j] == target.getId()) {
                        para.getRules()[j] = _labelViewContainerID;
                    }
                }
                view.setLayoutParams(para);
            }
        }
        parentContainer.removeView(target);

        // new dummy layout
        FrameLayout labelViewContainer = new FrameLayout(getContext());
        ViewGroup.LayoutParams targetLayoutParam = target.getLayoutParams();
        labelViewContainer.setLayoutParams(targetLayoutParam);
        target.setLayoutParams(new ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

        // add target and label in dummy layout
        labelViewContainer.addView(target);
        labelViewContainer.addView(this);
        labelViewContainer.setId(_labelViewContainerID);

        // add dummy layout in parent container
        parentContainer.addView(labelViewContainer, groupIndex, targetLayoutParam);
    }
    return true;
}
 
源代码17 项目: chat-window-android   文件: ChatWindowActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    int frameId = 101;

    LinearLayout linearLayout = new LinearLayout(this);
    FrameLayout frameLayout = new FrameLayout(this);
    //noinspection ResourceType
    frameLayout.setId(frameId);

    linearLayout.addView(frameLayout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    setContentView(linearLayout);

    Object licenceNumber = null;
    Object groupId = null;
    String visitorName = null;
    String visitorEmail = null;
    HashMap<String, String> customVariables = new HashMap<>();

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        licenceNumber = String.valueOf(extras.get(ChatWindowConfiguration.KEY_LICENCE_NUMBER));
        groupId = String.valueOf(extras.get(ChatWindowConfiguration.KEY_GROUP_ID));

        if (extras.containsKey(ChatWindowConfiguration.KEY_VISITOR_NAME)) {
            visitorName = String.valueOf(extras.get(ChatWindowConfiguration.KEY_VISITOR_NAME));
        }

        if (extras.containsKey(ChatWindowConfiguration.KEY_VISITOR_EMAIL)) {
            visitorEmail = String.valueOf(extras.get(ChatWindowConfiguration.KEY_VISITOR_EMAIL));
        }
        for (String key : extras.keySet()) {
            if (!DEFINED_KEYS.contains(key)) {
                customVariables.put(key, String.valueOf(extras.get(key)));
            }
        }
    }

    FragmentTransaction ft = getFragmentManager().beginTransaction();
    //noinspection ResourceType
    ft.replace(frameId, ChatWindowFragment.newInstance(licenceNumber, groupId, visitorName, visitorEmail, customVariables));
    ft.commit();
}
 
源代码18 项目: MaterialTabHost   文件: MaterialTabHost.java
public MaterialTabHost(Context context, AttributeSet attrs) {
    super(context, attrs);

    inflater = LayoutInflater.from(context);

    TypedValue outValue = new TypedValue();
    Resources.Theme theme = context.getTheme();

    // use ?attr/colorPrimary as background color
    theme.resolveAttribute(R.attr.colorPrimary, outValue, true);
    setBackgroundColor(outValue.data);

    // use ?attr/colorControlActivated as default indicator color
    theme.resolveAttribute(R.attr.colorControlActivated, outValue, true);
    colorControlActivated = outValue.data;

    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MaterialTabHost, 0, 0);
    int indicatorColor = a.getColor(R.styleable.MaterialTabHost_colorTabIndicator, colorControlActivated);
    a.recycle();

    // ColorDrawable on 2.x does not use getBounds() so use ShapeDrawable
    indicator = new ShapeDrawable();
    indicator.setColorFilter(indicatorColor, PorterDuff.Mode.SRC_ATOP);

    Resources res = context.getResources();
    indicatorHeight = res.getDimensionPixelSize(R.dimen.mth_tab_indicator_height);
    leftOffset = res.getDimensionPixelSize(R.dimen.mth_tab_left_offset);
    int tabHeight = res.getDimensionPixelSize(R.dimen.mth_tab_height);

    tabWidget = new TabWidget(context);
    tabWidget.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, tabHeight));
    tabWidget.setId(android.R.id.tabs);
    tabWidget.setStripEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        tabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }
    addView(tabWidget);

    FrameLayout fl = new FrameLayout(context);
    fl.setLayoutParams(new LayoutParams(0, 0));
    fl.setId(android.R.id.tabcontent);
    addView(fl);

    setup();

    setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if (listener != null) {
                listener.onTabSelected(Integer.valueOf(tabId));
            }
        }
    });

    float density = getResources().getDisplayMetrics().density;

    // set elevation for App bar
    // http://www.google.com/design/spec/what-is-material/objects-in-3d-space.html#objects-in-3d-space-elevation
    ViewCompat.setElevation(this, APP_TAB_ELEVATION * density);
}
 
源代码19 项目: FloatUtil   文件: Window.java
public Window(WindowWrapper windowWrapper) {
    super(windowWrapper.getContext());

    mContext = windowWrapper.getContext();
    mWindowWrapper = windowWrapper;

    this.id = mWindowWrapper.WindowId;
    this.originalParams = windowWrapper.onRequestLayoutParams();
    this.flags = windowWrapper.onRequestWindowFlags();
    this.touchInfo = new TouchInfo();
    touchInfo.ratio = (float) originalParams.width / originalParams.height;
    this.data = new Bundle();

    // create the window contents
    FrameLayout content = new FrameLayout(mContext);
    content.setId(android.R.id.content);
    addView(content);

    mLongPressRunnable = new Runnable() {

        @Override
        public void run() {
            if (mWindowWrapper.handleLongClick()){
                touchInfo.isLongPress = true;
                mWindowWrapper.onLongPressed();
            }
        }
    };

    content.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {

            // pass all touch events to the implementation
            boolean consumed = false;

            final StandOutWindowManager windowManager = mWindowWrapper.getWindowManager();


            dispatchLongPress(event);
            // handle move and bring to front
            consumed = windowManager.onTouchHandleMove(Window.this, v, event)
                    || consumed;

            // alert implementation
            consumed = mWindowWrapper.onTouchBody(Window.this, v, event)
                    || consumed;

            return consumed;
        }
    });


    // attach the view corresponding to the id from the
    // implementation
    windowWrapper.onCreateAndAttachView(content);

    // make sure the implementation attached the view
    if (content.getChildCount() == 0) {
        Log.e(TAG, "You must attach your view to the given frame in onCreateAndAttachView()");
    }

    // attach the existing tag from the frame to the window
    setTag(content.getTag());
    windowWrapper.isCreated = true;
}
 
源代码20 项目: ShareLoginPayUtil   文件: _ShareActivity.java
private void setCusContentView() {
    FrameLayout container = new FrameLayout(_ShareActivity.this);
    container.setId(R.id.id_share_container);
    container.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    setContentView(container);
}