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.ruesga.rview.widget.ScoresView.java

public ScoresView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setOrientation(LinearLayout.HORIZONTAL);
}

From source file:com.aniruddhc.xPlod.ui.widgets.ScrollableTabView.java

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

    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  w  w  .  j a  va2 s . c  o  m*/
    mContainer.setOrientation(LinearLayout.HORIZONTAL);

    this.addView(mContainer);

}

From source file:com.liberorignanese.android.stepindicatorview.Step.java

public void setUpView(View stepView, Step previous, Step next, int orientation, boolean useSecondaryStepColor) {
    ImageView iconView = (ImageView) stepView.findViewById(R.id.icon_step_layout);
    ImageView lineStartView = (ImageView) stepView.findViewById(R.id.linestart_step_layout);
    ImageView lineEndView = (ImageView) stepView.findViewById(R.id.lineend_step_layout);
    TextView textView = (TextView) stepView.findViewById(R.id.text_step_layout);

    int line_completed = orientation == LinearLayout.HORIZONTAL
            ? (useSecondaryStepColor ? R.drawable.line_completed_horizontal_secondary
                    : R.drawable.line_completed_horizontal)
            : (useSecondaryStepColor ? R.drawable.line_completed_vertical_secondary
                    : R.drawable.line_completed_vertical);
    int line_uncompleted = orientation == LinearLayout.HORIZONTAL
            ? (useSecondaryStepColor ? R.drawable.line_uncompleted_horizontal_secondary
                    : R.drawable.line_uncompleted_horizontal)
            : (useSecondaryStepColor ? R.drawable.line_uncompleted_vertical_secondary
                    : R.drawable.line_uncompleted_vertical);
    int icon_completed = useSecondaryStepColor ? R.drawable.icon_check_secondary : R.drawable.icon_check;
    int icon_uncompleted = useSecondaryStepColor ? R.drawable.icon_circle_secondary : R.drawable.icon_circle;
    int icon_completed_current = useSecondaryStepColor ? R.drawable.icon_check_secondary_current
            : R.drawable.icon_check_current;
    int step_backgroundcolor = Color.TRANSPARENT;
    int step_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary
            : R.color.stepviewindicator_maincolor;
    int step_iscurrent_backgroundcolor = useSecondaryStepColor ? R.color.stepviewindicator_maincolor_secondary
            : R.color.stepviewindicator_maincolor;
    int step_iscurrent_textcolor = useSecondaryStepColor ? R.color.stepviewindicator_checkcolor_secondary
            : R.color.stepviewindicator_checkcolor;

    /*//www.j av a2s . com
            if(useSecondaryStepColor){
            
            }
    */

    if (previous == null) {
        lineStartView.setVisibility(View.INVISIBLE);
    } else {
        lineStartView.setVisibility(View.VISIBLE);
        if (previous.isCompleted()) {
            lineStartView.setImageResource(line_completed);
            lineStartView.setImageAlpha(255);
        } else {
            lineStartView.setImageResource(line_uncompleted);
            lineStartView.setImageAlpha(alpha);
        }
    }
    if (next == null) {
        lineEndView.setVisibility(View.INVISIBLE);
    } else {
        lineEndView.setVisibility(View.VISIBLE);
        if (isCompleted()) {
            lineEndView.setImageResource(line_completed);
            lineEndView.setImageAlpha(255);
        } else {
            lineEndView.setImageResource(line_uncompleted);
            lineEndView.setImageAlpha(alpha);
        }
    }
    textView.setText(getText());
    if (isCompleted()) {
        iconView.setImageResource(current ? icon_completed_current : icon_completed);
        iconView.setImageAlpha(255);
    } else {
        iconView.setImageResource(icon_uncompleted);
        if (isCurrent()) {
            iconView.setImageAlpha(255);
        } else {
            iconView.setImageAlpha(alpha);
        }
    }

    if (isCurrent()) {
        textView.setTypeface(null, Typeface.BOLD);
        textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_iscurrent_textcolor));
        textView.setBackgroundColor(
                ContextCompat.getColor(stepView.getContext(), step_iscurrent_backgroundcolor));
    } else {
        textView.setTypeface(null, Typeface.NORMAL);
        textView.setTextColor(ContextCompat.getColor(stepView.getContext(), step_textcolor));
        textView.setBackgroundColor(step_backgroundcolor);
    }
    /*
            if(useSecondaryStepColor){
    textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor_secondary));
            }else{
    textView.setTextColor(ContextCompat.getColor(stepView.getContext(), R.color.stepviewindicator_maincolor));
            }
    */
    stepView.setOnClickListener(onClickListener);

}

From source file:com.gandulf.guilib.view.adapter.MultiFragmentPagerAdapter.java

@Override
public Object instantiateItem(View container, int position) {
    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }//from  w w  w .jav a 2s  .c om

    LinearLayout v = new LinearLayout(mContext);
    v.setOrientation(LinearLayout.HORIZONTAL);
    v.setWeightSum(getCount(position));

    int startIndex = getStartIndex(position);

    int containerId = 0;
    final int size = getCount(position);
    for (int i = 0; i < size; i++) {

        containerId = startIndex + i;

        String name = makeFragmentName(container.getId(), containerId);
        Fragment fragment = mFragmentManager.findFragmentByTag(name);

        FrameLayout fragmentView = new FrameLayout(mContext);
        LayoutParams layoutParams = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1);
        fragmentView.setLayoutParams(layoutParams);
        fragmentView.setId(containerId);
        v.addView(fragmentView, i);

        if (fragment != null) {
            Debug.verbose("Attaching item #" + position + ": f=" + fragment + " id:" + containerId);
            mCurTransaction.attach(fragment);
        } else {
            // index is 1 based remove 1 to get a 0-based
            fragment = getItem(position, i);
            if (fragment != null) {
                Debug.verbose("Adding item #" + position + ": f=" + fragment + " id:" + containerId);
                mCurTransaction.add(containerId, fragment, name);
            }
        }
        if (fragment != null && !mCurrentPrimaryItems.contains(fragment)) {
            fragment.setMenuVisibility(false);
            fragment.setUserVisibleHint(false);
        }
    }

    mCurTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);

    ((ViewPager) container).addView(v, 0);

    return v;
}

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

public ScrollableTabView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs);
    //       super(context, attrs, defStyle);
    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  w w. j  a  va  2  s .c  o m*/
    mContainer.setOrientation(LinearLayout.HORIZONTAL);

    this.addView(mContainer);

}

From source file:com.example.testsurrondviewpager.PagerContainer.java

private void init() {
    //Disable clipping of children so non-selected pages are visible
    setClipChildren(false);/*from w w w.  j a  v a  2s.co m*/
    setWeightSum(3.0f);
    setOrientation(LinearLayout.HORIZONTAL);
    //Child clipping doesn't work with hardware acceleration in Android 3.x/4.x
    //You need to set this value here if using hardware acceleration in an
    // application targeted at these releases.
    //  setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    try {
        Method setLayerTypeMethod = this.getClass().getMethod("setLayerType",
                new Class[] { int.class, Paint.class });
        setLayerTypeMethod.invoke(this, new Object[] { LAYER_TYPE_SOFTWARE, null });
    } catch (NoSuchMethodException e) {
        // Older OS, no HW acceleration anyway
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}

From source file:com.matthewtamlin.sliding_intro_screen_manual_testing.TestPageLock.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Create a layout to display the control buttons over the ViewPager
    final LinearLayout controlButtonHolder = new LinearLayout(this);
    controlButtonHolder.setOrientation(LinearLayout.HORIZONTAL);
    getRootView().addView(controlButtonHolder);

    // Create a layout to display buttons for changing the page
    final LinearLayout pageChangeButtonHolder = new LinearLayout(this);
    pageChangeButtonHolder.setOrientation(LinearLayout.VERTICAL);
    controlButtonHolder.addView(pageChangeButtonHolder);

    // Create a layout to display buttons for locking the ViewPager
    final LinearLayout pageLockButtonHolder = new LinearLayout(this);
    pageLockButtonHolder.setOrientation(LinearLayout.VERTICAL);
    controlButtonHolder.addView(pageLockButtonHolder);

    // Create the button for changing the page
    pageChangeButtonHolder.addView(createGoToFirstPageButton());
    pageChangeButtonHolder.addView(createGoToLastPageButton());
    pageChangeButtonHolder.addView(createGoToPreviousPageButton());
    pageChangeButtonHolder.addView(createGoToNextPageButton());
    pageChangeButtonHolder.addView(createGoToSpecificPageButton(SPECIFIC_PAGE));

    // Create the buttons for locking the page
    pageLockButtonHolder.addView(createLockTouchButton());
    pageLockButtonHolder.addView(createLockCommandButton());
    pageLockButtonHolder.addView(createLockAllButton());
    pageLockButtonHolder.addView(createUnlockButton());
}

From source file:cn.qbcbyb.library.view.PagerTabStrip.java

public PagerTabStrip(Context context, AttributeSet attrs) {
    super(context, attrs);

    setWillNotDraw(false);/*from   w  w  w. j a  v a2 s . c om*/

    setOrientation(LinearLayout.HORIZONTAL);

    // get custom attrs

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagerTabStrip);

    indicatorDrawable = a.getResourceId(R.styleable.PagerTabStrip_indicatorDrawable,
            R.drawable.pager_indicator);

    a.recycle();

}

From source file:com.astuetz.viewpager.extensions.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 ww. j  av  a 2  s.  c  o m
    mDividerMarginBottom = a.getDimensionPixelSize(R.styleable.ViewPagerExtensions_dividerMarginBottom,
            mDividerMarginBottom);

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

    a.recycle();

    this.setOrientation(LinearLayout.HORIZONTAL);
}

From source file:ch.pantas.billsplitter.ui.FixedTabsView.java

public FixedTabsView(Context context, AttributeSet attrs) {
    super(context, attrs);
    pageListener = new PageListener();

    tabsContainer = new LinearLayout(context);
    tabsContainer.setOrientation(LinearLayout.HORIZONTAL);
    tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    addView(tabsContainer);/* ww w  .j  ava 2 s. co  m*/

    rectPaint = new Paint();
    rectPaint.setAntiAlias(true);
    rectPaint.setStyle(Paint.Style.FILL);

    dividerPaint = new Paint();
    dividerPaint.setAntiAlias(true);
    dividerPaint.setStrokeWidth(dividerWidth);
}