Java Code Examples for android.widget.FrameLayout#setId()

The following examples show how to use android.widget.FrameLayout#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListFragment.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: Case5Scene.java    From scene with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 3
Source File: FragmentTabHost.java    From MiBandDecompiled with Apache License 2.0 6 votes vote down vote up
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));
    }
}
 
Example 4
Source File: TestActivity.java    From glide-support with The Unlicense 6 votes vote down vote up
@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();
	}
}
 
Example 5
Source File: PullToNextLayout.java    From Android-PullToNextLayout with Apache License 2.0 5 votes vote down vote up
/**
 * 初始化 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;
}
 
Example 6
Source File: ExpandableListItemAdapter.java    From ALLGO with Apache License 2.0 5 votes vote down vote up
private void init() {
	setOrientation(VERTICAL);

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

	mContentViewGroup = new FrameLayout(getContext());
	mContentViewGroup.setId(DEFAULTCONTENTPARENTRESID);
	addView(mContentViewGroup);
}
 
Example 7
Source File: FragmentTabHost.java    From guideshow with MIT License 5 votes vote down vote up
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));
    }
}
 
Example 8
Source File: PreviewActivity.java    From APDE with GNU General Public License v2.0 5 votes vote down vote up
@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();
	}
}
 
Example 9
Source File: FragmentTabHost.java    From NetEasyNews with GNU General Public License v3.0 5 votes vote down vote up
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));
    }
}
 
Example 10
Source File: SaveAndRestoreTests.java    From scene with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public ViewGroup onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container, @Nullable Bundle savedInstanceState) {
    FrameLayout layout = new FrameLayout(requireSceneContext());
    layout.setId(id);
    return layout;
}
 
Example 11
Source File: RootActivity.java    From FragmentStack with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 12
Source File: TwinklingRefreshLayout.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
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()));
        }
    }
}
 
Example 13
Source File: BaseFragmentActivity.java    From BaseUIFrame with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    QMUIStatusBarHelper.translucent(this);
    mFragmentContainer = new FrameLayout(this);
    mFragmentContainer.setId(getContextViewId());
    setContentView(mFragmentContainer);
}
 
Example 14
Source File: FragmentTabHost.java    From adt-leanback-support with Apache License 2.0 5 votes vote down vote up
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));
    }
}
 
Example 15
Source File: TestAppCompatActivity.java    From scene with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 16
Source File: LabelView.java    From labelview with Apache License 2.0 4 votes vote down vote up
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;
}
 
Example 17
Source File: ChatWindowActivity.java    From chat-window-android with MIT License 4 votes vote down vote up
@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();
}
 
Example 18
Source File: MaterialTabHost.java    From MaterialTabHost with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example 19
Source File: Window.java    From FloatUtil with MIT License 4 votes vote down vote up
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;
}
 
Example 20
Source File: _ShareActivity.java    From ShareLoginPayUtil with Apache License 2.0 4 votes vote down vote up
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);
}