Example usage for android.widget LinearLayout VERTICAL

List of usage examples for android.widget LinearLayout VERTICAL

Introduction

In this page you can find the example usage for android.widget LinearLayout VERTICAL.

Prototype

int VERTICAL

To view the source code for android.widget LinearLayout VERTICAL.

Click Source Link

Usage

From source file:com.admin.control.ab.AbSlidingPlayView.java

/**
 * ???View.//  w w w. ja v a 2 s . co m
 *
 * @param context the context
 */
public void initView(Context context) {
    this.context = context;
    //TODO >>
    layoutParamsFF = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParamsFW = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    layoutParamsWF = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
    //TODO <<
    navLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    this.setOrientation(LinearLayout.VERTICAL);

    RelativeLayout mRelativeLayout = new RelativeLayout(context);
    mViewPager = new AbInnerViewPager(context);
    //ViewPager,fragmentsetId()id
    //        mViewPager.setId(1985);
    //
    mNavLayoutParent = new LinearLayout(context);
    mNavLayoutParent.setPadding(0, 5, 0, 5);
    navLinearLayout = new LinearLayout(context);
    navLinearLayout.setPadding(15, 1, 15, 1);
    navLinearLayout.setVisibility(View.INVISIBLE);
    mNavLayoutParent.addView(navLinearLayout,
            new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
    lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    mRelativeLayout.addView(mViewPager, lp1);

    RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
    mRelativeLayout.addView(mNavLayoutParent, lp2);
    addView(mRelativeLayout, layoutParamsFW);
    //        addView(mRelativeLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

    //?
    displayImage = ABFileUtil.getBitmapFromSrc("play_display.png");
    hideImage = ABFileUtil.getBitmapFromSrc("play_hide.png");

    mListViews = new ArrayList<>();
    mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews);
    mViewPager.setAdapter(mAbViewPagerAdapter);
    mViewPager.setFadingEdgeLength(0);
    mViewPager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            if (mAbScrolledListener != null) {
                if (position == 0)
                    mAbScrolledListener.onScrollToLeft();
                if (position == mListViews.size() - 1)
                    mAbScrolledListener.onScrollToRight();
            }
            setNowPlayIndex(position);
            makesurePosition();
            onPageSelectedCallBack(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            onPageScrolledCallBack(position);
        }

    });

}

From source file:com.tang.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);
        // //  ww  w. j  ava2 s.  co  m
        tw.setShowDividers(TabWidget.SHOW_DIVIDER_NONE);
        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));
    }
}

From source file:com.google.samples.apps.topeka.widget.quiz.AbsQuizView.java

private LinearLayout createContainerLayout(Context context) {
    LinearLayout container = new LinearLayout(context);
    container.setId(R.id.absQuizViewContainer);
    container.setOrientation(LinearLayout.VERTICAL);
    return container;
}

From source file:com.ustc.dystu.dandelion.fragment.BaseFragmentTabHost.java

private void initFragmentTabHost(Context context, AttributeSet attrs) {
    TypedArray a = context.obtainStyledAttributes(attrs, new int[] { android.R.attr.inflatedId }, 0, 0);
    mContainerId = a.getResourceId(0, 0);
    a.recycle();//from w w  w  .jav  a2  s .c  om

    super.setOnTabChangedListener(this);

    // 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);
        tw.setDividerDrawable(null);//?ab?
        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));
    }
}

From source file:com.devilyang.musicstation.widget.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);//w  w w  .  j ava 2s  .  c o m
        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));
    }
}

From source file:com.ai.eve.lenovo.widget.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.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

        TabWidget tw = new TabWidget(context);
        tw.setId(android.R.id.tabs);/*ww  w  . j  a  v a2 s  .co  m*/
        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));
    }
}

From source file:com.focosee.qingshow.widget.MVerticalViewPager.java

private void init() {
    mRootContainer = new LinearLayout(this.getContext());
    mRootContainer.setOrientation(LinearLayout.VERTICAL);
    this.addView(mRootContainer);
    this.setVerticalScrollBarEnabled(false);
    mViews = new View[0];
}

From source file:eu.power_switch.gui.fragment.configure_scene.ConfigureSceneDialogPage1NameFragment.java

private void addReceiversToLayout() {
    String inflaterString = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(inflaterString);

    try {//  w  w w  .ja va  2s . c om
        for (Room room : DatabaseHandler.getRooms(SmartphonePreferencesHandler.getCurrentApartmentId())) {
            LinearLayout roomLayout = new LinearLayout(getActivity());
            roomLayout.setOrientation(LinearLayout.VERTICAL);
            roomLayout.setPadding(0, 8, 0, 8);
            linearLayout_selectableReceivers.addView(roomLayout);

            TextView roomName = new TextView(getActivity());
            roomName.setText(room.getName());
            roomName.setTextColor(
                    ThemeHelper.getThemeAttrColor(getActivity(), android.R.attr.textColorPrimary));
            roomLayout.addView(roomName);

            for (Receiver receiver : room.getReceivers()) {
                LinearLayout receiverLayout = new LinearLayout(getActivity());
                receiverLayout.setOrientation(LinearLayout.HORIZONTAL);
                roomLayout.addView(receiverLayout);

                final CheckBox checkBox = (CheckBox) inflater.inflate(R.layout.simple_checkbox, receiverLayout,
                        false);
                checkBox.setTag(R.string.room, room);
                checkBox.setTag(R.string.receiver, receiver);
                receiverLayout.addView(checkBox);
                checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    @Override
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        checkValidity();
                    }
                });
                receiverCheckboxList.add(checkBox);

                TextView textView_receiverName = new TextView(getActivity());
                textView_receiverName.setText(receiver.getName());
                receiverLayout.addView(textView_receiverName);

                receiverLayout.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        checkBox.setChecked(!checkBox.isChecked());
                    }
                });
            }
        }
    } catch (Exception e) {
        StatusMessageHandler.showErrorMessage(getActivity(), e);
    }
}

From source file:mobisocial.musubi.objects.PictureObj.java

@Override
public View createView(Context context, ViewGroup parent) {
    LinearLayout frame = new LinearLayout(context);
    frame.setLayoutParams(CommonLayouts.FULL_WIDTH);
    frame.setOrientation(LinearLayout.VERTICAL);

    ImageView imageView = new ImageView(context);
    imageView.setBackgroundResource(android.R.drawable.picture_frame);
    imageView.setPadding(6, 4, 8, 9);/*from   w  ww . j av a2s . co  m*/
    frame.addView(imageView);

    TextView textView = new TextView(context);
    frame.addView(textView);

    return frame;
}

From source file:com.example.almin.widget.MyFragmentTabHost.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.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        TabWidget tw = new TabWidget(context);
        tw.setId(android.R.id.tabs);/*from  w  w w  .j  av a  2 s .co  m*/
        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));
    }
}