Example usage for android.widget LinearLayout HORIZONTAL

List of usage examples for android.widget LinearLayout HORIZONTAL

Introduction

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

Prototype

int HORIZONTAL

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

Click Source Link

Usage

From source file:com.andrew.apollo.ui.widgets.ScrollableTabView.java

public ScrollableTabView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);

    this.mContext = context;

    mDividerMarginTop = (int) (getResources().getDisplayMetrics().density * mDividerMarginTop);
    mDividerMarginBottom = (int) (getResources().getDisplayMetrics().density * mDividerMarginBottom);
    mDividerWidth = (int) (getResources().getDisplayMetrics().density * mDividerWidth);

    this.setHorizontalScrollBarEnabled(false);
    this.setHorizontalFadingEdgeEnabled(false);

    mContainer = new LinearLayout(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT);
    mContainer.setLayoutParams(params);//from ww  w  .  ja v a 2s.  co  m
    mContainer.setOrientation(LinearLayout.HORIZONTAL);

    this.addView(mContainer);

}

From source file:com.charon.video.view.ScrollingTabs.java

private void init(Context context) {
    this.setHorizontalScrollBarEnabled(false);
    this.setHorizontalFadingEdgeEnabled(false);

    mContainer = new LinearLayout(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT);
    mContainer.setLayoutParams(params);/*from  w ww  .  j  a va2  s .com*/
    mContainer.setOrientation(LinearLayout.HORIZONTAL);

    addView(mContainer);

    mWindowWidth = getWindowWidth(context);
}

From source file:com.charon.materialsample.view.ScrollingTabs.java

protected void init(Context context) {
    this.setHorizontalScrollBarEnabled(false);
    this.setHorizontalFadingEdgeEnabled(false);

    mContainer = new LinearLayout(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mContainer.setLayoutParams(params);//from  w  w w  .  j  a v  a 2 s .co m
    mContainer.setOrientation(LinearLayout.HORIZONTAL);

    addView(mContainer);

    mWindowWidth = getWindowWidth(context);
}

From source file:com.prettygirl.avgallery.components.FixedTabsView.java

public FixedTabsView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);

    this.mContext = context;

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ViewPagerExtensions, defStyle, 0);

    mDividerColor = a.getColor(R.styleable.ViewPagerExtensions_dividerColor, mDividerColor);

    mDividerMarginTop = a.getDimensionPixelSize(R.styleable.ViewPagerExtensions_dividerMarginTop,
            mDividerMarginTop);/*from   w w  w  . jav  a2s  .  com*/
    mDividerMarginBottom = a.getDimensionPixelSize(R.styleable.ViewPagerExtensions_dividerMarginBottom,
            mDividerMarginBottom);

    mDividerVisibility = a.getInt(R.styleable.ViewPagerExtensions_dividerVisibility, View.VISIBLE);

    mDividerDrawable = a.getDrawable(R.styleable.ViewPagerExtensions_dividerDrawable);

    a.recycle();

    this.setOrientation(LinearLayout.HORIZONTAL);
}

From source file:com.garage.payless.fragment.FragmentList.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.list_fragment, container, false);

    DelayAutoCompleteTextView bookTitle = (DelayAutoCompleteTextView) rootView.findViewById(R.id.book_title);
    bookTitle.setThreshold(4);//from  w ww . j a  va  2  s .  c  o  m
    bookTitle.setAdapter(new GoodAutoCompleteAdapter(getActivity().getApplicationContext()));
    bookTitle.setLoadingIndicator((ProgressBar) rootView.findViewById(R.id.progress_bar));
    bookTitle.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            LinearLayout basketList = (LinearLayout) rootView.findViewById(R.id.basket);
            LinearLayout row = new LinearLayout(getActivity().getApplicationContext());
            row.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT));
            row.setOrientation(LinearLayout.HORIZONTAL);
            TextView valueTV = new TextView(getActivity().getApplicationContext());
            valueTV.setText((String) adapterView.getItemAtPosition(position));
            valueTV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT));
            row.addView(valueTV);
            ImageButton cancel = new ImageButton(getActivity().getApplicationContext());
            cancel.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT));
            cancel.setImageDrawable(Drawable.createFromPath("@android:drawable/ic_menu_close_clear_cancel"));
            row.addView(cancel);
            basketList.addView(row);
        }
    });
    rootView.findViewById(R.id.create_btn).setOnClickListener(this);
    return rootView;
}

From source file:com.charon.scrollingtabs.view.ScrollingTabs.java

protected void init(Context context) {
    this.setHorizontalScrollBarEnabled(false);
    this.setHorizontalFadingEdgeEnabled(false);

    mContainer = new LinearLayout(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT);
    mContainer.setLayoutParams(params);//from   ww w. ja  v  a 2 s . c  o m
    mContainer.setOrientation(LinearLayout.HORIZONTAL);

    addView(mContainer);

    mWindowWidth = getWindowWidth(context);
}

From source file:com.saulcintero.moveon.ui.widgets.ScrollableTabView.java

public ScrollableTabView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);

    mContext = context;/*from  w ww  .  j  a  v  a 2  s.c  om*/
    res = getResources();

    mDividerMarginTop = (int) (res.getDisplayMetrics().density * mDividerMarginTop);
    mDividerMarginBottom = (int) (res.getDisplayMetrics().density * mDividerMarginBottom);
    mDividerWidth = (int) (res.getDisplayMetrics().density * mDividerWidth);

    this.setHorizontalScrollBarEnabled(false);
    this.setHorizontalFadingEdgeEnabled(false);

    mContainer = new LinearLayout(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT);
    mContainer.setLayoutParams(params);
    mContainer.setOrientation(LinearLayout.HORIZONTAL);

    this.addView(mContainer);

}

From source file:com.toaker.framework.core.widget.NavigationBarImpl.java

/**
 * Decorator for framework-master//from www .  j  a  v a2 s .  c o m
 *
 * @author Toaker [Toaker](ToakerQin@gmail.com)
 *         [Toaker](http://www.toaker.com)
 * @Description: init
 * @Time Create by 2015/4/6 15:35
 */
private void initialize() {
    mViewGroup = new LinearLayout(getContext());
    mNavigates = new ArrayMap<Integer, Navigation>();
    mViewGroup.setOrientation(LinearLayout.HORIZONTAL);
    params.weight = 1;
    params.gravity = Gravity.CENTER;
    super.addView(mViewGroup);
    this.mNavigationHeight = super.getResources().getDimension(R.dimen.abs__navigation_bar_default_height);
    //        if(ScaleController.getInstance() != null){
    //            mNavigationHeight = ScaleController.getInstance().getScreenHeight() * 0.23f;
    //        }
    setNavigationBarHeight((int) this.mNavigationHeight);

}

From source file:com.kai.uGuide.ui.fragment.SuperAwesomeCardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    FrameLayout fl = new FrameLayout(getActivity());
    fl.setLayoutParams(params);/*from  w  ww . ja va  2 s . c  o  m*/

    //        final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources()
    //                .getDisplayMetrics());
    //
    //        TextView v = new TextView(getActivity());
    //        params.setMargins(margin, margin, margin, margin);
    //        v.setLayoutParams(params);
    //        v.setLayoutParams(params);
    //        v.setGravity(Gravity.CENTER);
    //        v.setBackgroundResource(R.drawable.background_card);
    //        v.setText("CARD " + (position + 1));
    //
    //        fl.addView(v);

    LinearLayout pagerlayout = new LinearLayout(getActivity());
    pagerlayout.setOrientation(LinearLayout.HORIZONTAL);
    pagerlayout.setId(300 + position);

    if (page == 0)
        adapter = AdapterTransitionFragment.newInstance(position);
    else
        adapter = ResultAdapterTransitionFragment.newInstance(position);

    getFragmentManager().beginTransaction().add(pagerlayout.getId(), adapter, "someTag" + position).commit();
    fl.addView(pagerlayout);

    return fl;
}

From source file:ca.hoogit.garagepi.Camera.CameraFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_camera, container, false);
    ButterKnife.bind(this, view);

    // Check if landscape and adjust views
    if (getResources().getBoolean(R.bool.is_landscape)) {
        mContainer.setOrientation(LinearLayout.HORIZONTAL);

        LinearLayout.LayoutParams cameraParams = (LinearLayout.LayoutParams) mCameraCard.getLayoutParams();
        cameraParams.width = 0;//from   w w w.java  2  s.co m
        cameraParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
        cameraParams.setMargins(0, 0, 0, 0);
        cameraParams.setMarginEnd(getResources().getDimensionPixelSize(R.dimen.card_container_margin));
        mCameraCard.requestLayout();

        ViewGroup.LayoutParams weatherParams = mWeatherCard.getLayoutParams();
        weatherParams.width = 0;
        weatherParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
        mWeatherCard.requestLayout();
    }

    mPlayStopButton.setOnClickListener(this::handlePlayStopButton);
    mRefreshButton.setOnClickListener(this::handleRefreshButton);

    mCameraSocket = new CameraSocket(getActivity());
    mCameraSocket.setOnFeed(this::handleUpdatingCameraFeed);
    mCameraSocket.setOnError(this::handleCameraError);

    // TODO display state of camera to user
    mCameraSocket.setOnEvent(this);

    if (savedInstanceState == null) {
        mCameraSocket.activate();
    }

    return view;
}