Java Code Examples for android.widget.LinearLayout.HORIZONTAL

The following are Jave code examples for showing how to use HORIZONTAL of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: CosmoCalendar   File: CalendarView.java   View Source Code Vote up 6 votes
@Override
public void setCalendarOrientation(int calendarOrientation) {
    clearSelections();
    settingsManager.setCalendarOrientation(calendarOrientation);
    setDaysOfWeekTitles();
    recreateInitialMonth();

    rvMonths.setLayoutManager(new GridLayoutManager(getContext(), 1, getCalendarOrientation(), false));

    changeSnapHelper();

    if (getCalendarOrientation() == LinearLayout.HORIZONTAL) {
        if (flNavigationButtons != null) {
            flNavigationButtons.setVisibility(VISIBLE);
        } else {
            createNavigationButtons();
        }
    } else {
        if (flNavigationButtons != null) {
            flNavigationButtons.setVisibility(GONE);
        }
    }

    setSelectionBarVisibility();
    update();
}
 
Example 2
Project: YCSlideView   File: FirstActivity.java   View Source Code Vote up 6 votes
private void initRecycleView() {
    for(int a=0 ; a<20 ; a++){
        YCBean bean;
        if(a==3||a==8||a==14||a==16){
            bean = new YCBean("",2,"修改","","杨充"+a,"2000","美元","北京","你好");
        }else {
            bean = new YCBean("",2,"完成","","杨充"+a,"2000","美元","北京","你好");
        }
        list.add(bean);
    }
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);                             // 如果Item够简单,高度是确定的,打开FixSize将提高性能。
    recyclerView.setItemAnimator(new DefaultItemAnimator());        // 设置Item默认动画,加也行,不加也行。
    final RecycleViewItemLine line = new RecycleViewItemLine(this, LinearLayout.HORIZONTAL,
            20, Color.parseColor("#f5f5f7"));
    recyclerView.addItemDecoration(line);// 添加分割线。
    adapter = new ItemSlideAdapter(this, mDeleteListener);
    recyclerView.setAdapter(adapter);
    adapter.setData(list);
    statusLayoutManager.showContent();
}
 
Example 3
Project: EpisodeListView   File: EpisodeListView.java   View Source Code Vote up 6 votes
private void init() {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(R.layout.episodelist_layout, this, true);

    mChildrenView = (RecyclerView) findViewById(R.id.episodes);
    mParentView = (RecyclerView) findViewById(R.id.groups);

    mEpisodesLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);
    mGroupLayoutManager = new LinearLayoutManager(mContext, LinearLayout.HORIZONTAL, false);

    mChildrenView.setLayoutManager(mEpisodesLayoutManager);
    mParentView.setLayoutManager(mGroupLayoutManager);

    mChildrenView.setItemAnimator(new DefaultItemAnimator());
    mParentView.setItemAnimator(new DefaultItemAnimator());

    mChildrenView.setOnFocusChangeListener(this);
    mParentView.setOnFocusChangeListener(this);
    this.setOnFocusChangeListener(this);
}
 
Example 4
Project: FriendBook   File: RecyclerViewItemDecoration.java   View Source Code Vote up 5 votes
/**
 * compatible with recyclerview layoutmanager
 *
 * @param parent
 */
private void compatibleWithLayoutManager(RecyclerView parent) {

    if (parent.getLayoutManager() != null) {
        if (parent.getLayoutManager() instanceof GridLayoutManager) {
            mMode = MODE_GRID;
        } else if (parent.getLayoutManager() instanceof LinearLayoutManager) {
            if (((LinearLayoutManager) parent.getLayoutManager()).getOrientation() == LinearLayout.HORIZONTAL) {
                mMode = MODE_VERTICAL;
            } else {
                mMode = MODE_HORIZONTAL;
            }
        }
    }
}
 
Example 5
Project: MyFire   File: ExpandableTextView.java   View Source Code Vote up 5 votes
@Override
public void setOrientation(int orientation) {
    if (LinearLayout.HORIZONTAL == orientation) {
        throw new IllegalArgumentException("ExpandableTextView only supports Vertical Orientation.");
    }
    super.setOrientation(orientation);
}
 
Example 6
Project: Widgets   File: ExpandTextView.java   View Source Code Vote up 5 votes
@Override
    public void setOrientation(int orientation) {
        if (LinearLayout.HORIZONTAL == orientation) {
//            throw new IllegalArgumentException("ExpandTextView only supports Vertical Orientation.");
            //强制使用垂直布局
            super.setOrientation(LinearLayout.VERTICAL);
        }
        super.setOrientation(orientation);
    }
 
Example 7
Project: SingleSelectBar   File: ResHelper.java   View Source Code Vote up 5 votes
ResHelper(@ColorInt int colorSelected, @ColorInt int colorUnselected, float roundRadius,
                 int strokeWidth, @ColorInt int colorPressed) {
    setColorSelected(colorSelected);
    setColorUnselected(colorUnselected);
    this.roundRadius = roundRadius;
    this.strokeWidth = strokeWidth;
    this.orientation = LinearLayout.HORIZONTAL;

    setColorPressed(colorPressed);
    setRoundRadius(roundRadius);
    updateCornerStateDrawable();
}
 
Example 8
Project: SingleSelectBar   File: ResHelper.java   View Source Code Vote up 5 votes
private void setStartRoundRadius(float[] cornetRadii, float roundRadius) {
    if (orientation == LinearLayout.HORIZONTAL) {
        Arrays.fill(cornetRadii, 0, 2, roundRadius);
        Arrays.fill(cornetRadii, 2, 6, 0F);
        Arrays.fill(cornetRadii, 6, 8, roundRadius);
    } else {
        Arrays.fill(cornetRadii, 0, 4, roundRadius);
        Arrays.fill(cornetRadii, 4, 8, 0F);
    }
}
 
Example 9
Project: SingleSelectBar   File: ResHelper.java   View Source Code Vote up 5 votes
private void setEndRoundRadius(float[] cornetRadii, float roundRadius) {
    if (orientation == LinearLayout.HORIZONTAL) {
        Arrays.fill(cornetRadii, 0, 2, 0F);
        Arrays.fill(cornetRadii, 2, 6, roundRadius);
        Arrays.fill(cornetRadii, 6, 8, 0F);
    } else {
        Arrays.fill(cornetRadii, 0, 4, 0F);
        Arrays.fill(cornetRadii, 4, 8, roundRadius);
    }
}
 
Example 10
Project: GCSApp   File: ExpandableTextView2.java   View Source Code Vote up 5 votes
@Override
public void setOrientation(int orientation) {
    if (LinearLayout.HORIZONTAL == orientation) {
        throw new IllegalArgumentException("ExpandableTextView only supports Vertical Orientation.");
    }
    super.setOrientation(orientation);
}
 
Example 11
Project: social-app-android   File: ExpandableTextView.java   View Source Code Vote up 5 votes
@Override
public void setOrientation(int orientation) {
    if (LinearLayout.HORIZONTAL == orientation) {
        throw new IllegalArgumentException("ExpandableTextView only supports Vertical Orientation.");
    }
    super.setOrientation(orientation);
}
 
Example 12
Project: RLibrary   File: RViewPager.java   View Source Code Vote up 5 votes
public RViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (mOrientation == LinearLayout.HORIZONTAL) {
        setPageTransformer(true, new FadeInOutPageTransformer());
    } else {
        setPageTransformer(true, new DefaultVerticalTransformer());
    }
    mGestureDetectorCompat = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() {

        @Override
        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
            if (mOnPagerEndListener != null &&
                    getAdapter() != null &&
                    getCurrentItem() == getAdapter().getCount() - 1) {
                if (mOrientation == LinearLayout.VERTICAL) {
                    if (velocityY < -1000) {
                        mOnPagerEndListener.onPagerEnd();
                    }
                } else {
                    if (velocityX < -1000) {
                        mOnPagerEndListener.onPagerEnd();
                    }
                }
            }
            return super.onFling(e1, e2, velocityX, velocityY);
        }
    });
}
 
Example 13
Project: GitHub   File: RecyclerViewActivity1.java   View Source Code Vote up 4 votes
private void initListAdapterH(){
    LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayout.HORIZONTAL, false);
    mRv.setLayoutManager(layoutManager);
    mRv.setAdapter(mListAdapter);
}