当前位置: 首页>>代码示例>>Java>>正文


Java LinearLayoutManager.setOrientation方法代码示例

本文整理汇总了Java中android.support.v7.widget.LinearLayoutManager.setOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayoutManager.setOrientation方法的具体用法?Java LinearLayoutManager.setOrientation怎么用?Java LinearLayoutManager.setOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.widget.LinearLayoutManager的用法示例。


在下文中一共展示了LinearLayoutManager.setOrientation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void init(Context context) {
    inflate(context, R.layout.home_list_wrapper, this);
    ButterKnife.bind(this);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context) {
        @Override
        protected int getExtraLayoutSpace(RecyclerView.State state) {
            return 200;
        }
    };
    linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    SnapHelper snapHelper = new GravitySnapHelper(Gravity.START);
    snapHelper.attachToRecyclerView(recyclerView);
    recyclerView.setHasFixedSize(true);
    recyclerView.setMotionEventSplittingEnabled(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(adapter);
}
 
开发者ID:prakh25,项目名称:MovieApp,代码行数:20,代码来源:HomeMovieLIstWrapper.java

示例2: initView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void initView() {
    mTabHeader = (TableLayout) findViewById(R.id.sql_tabview_header_tab);
    mRecycleView = (FastScrollRecyclerView) findViewById(R.id.sql_tabview_recycleview);
    mLinearLayoutManager = new LinearLayoutManager(SqlTabDatasActivity.this);
    mLinearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecycleView.setLayoutManager(mLinearLayoutManager);
    mContent = (MyHorizontalScrollView) findViewById(R.id.content);
    mRecycleView.setMinimumWidth(FeViewUtils.getScreenWidth(this));
    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    mAdmobLayout = (RelativeLayout) findViewById(R.id.admob_layout);
    mRootLayout = (RelativeLayout) findViewById(R.id.rootLayout);
    mAdView = (AdView) findViewById(R.id.adView);
    mAdMobBgBtn = (Button) findViewById(R.id.admob_bg_btn);
    mAdClose = (ImageView) findViewById(R.id.admob_close);
    btn = (FloatingActionButton) findViewById(R.id.fab);
    mTabHeader.setBackground(getResources().getDrawable(R.color.table_head_bg));

    if (dataSource != SqlConstant.TABLE_DATAS_NORMAL) {
        btn.setVisibility(View.GONE);
    } else {
        btn.setVisibility(View.VISIBLE);
    }

    resultHandler = new SqlActivityResultHandler(this);
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:26,代码来源:SqlTabDatasActivity.java

示例3: onCreateView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View mRootView = inflater.inflate(R.layout.fragment_map,container,false);
    hotels = new ArrayList<>();


    SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map_item);
    mapFragment.getMapAsync(this);

     recyclerView = (RecyclerView) mRootView.findViewById(R.id.map_recycler_view);
    recyclerView.setHasFixedSize(true);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setOrientation(LinearLayout.HORIZONTAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    mAdapter = new CardViewAdapter(hotels);
    mAdapter.setActionListner(this);
    recyclerView.setAdapter(mAdapter);

    if (mPresenter != null)
        mPresenter.loadHotels();


    return mRootView;
}
 
开发者ID:Elbehiry,项目名称:Viajes,代码行数:27,代码来源:MapFragment.java

示例4: onCreateView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View fragmen =inflater.inflate(R.layout.fragment_comentarios_recientes, container, false);
    LinearLayoutManager llm = new LinearLayoutManager(getContext());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerViewComentarios = (RecyclerView) fragmen.findViewById(R.id.recyclerComentarios);
    mNoNotificacionView = (LinearLayout) fragmen.findViewById(R.id.noMessages);
    recyclerViewComentarios.setLayoutManager(llm);
    // Guardo la instancia para poder llamar a `resetState()` para nuevas busquedas
    scrollListener = new EndlessRecyclerViewScrollListener(llm) {
        @Override
        public void onLoadMore(int page, int totalItemsCount, RecyclerView view) {
            // El evento sólo se provoca cuando necesito añadir más elementos
            cargarMasComentarios(page);
        }
    };


    return fragmen;
}
 
开发者ID:nen155,项目名称:TFG-SmartU-La-red-social,代码行数:23,代码来源:FragmentComentarios.java

示例5: setAdapter

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
/**
 * 设置导演&演员adapter
 */
private void setAdapter(MovieDetailBean movieDetailBean) {
    binding.xrvCast.setVisibility(View.VISIBLE);
    LinearLayoutManager mLayoutManager = new LinearLayoutManager(MovieDetailActivity.this);
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    binding.xrvCast.setLayoutManager(mLayoutManager);
    binding.xrvCast.setPullRefreshEnabled(false);
    binding.xrvCast.setLoadingMoreEnabled(false);
    // 需加,不然滑动不流畅
    binding.xrvCast.setNestedScrollingEnabled(false);
    binding.xrvCast.setHasFixedSize(false);

    MovieDetailAdapter mAdapter = new MovieDetailAdapter();
    mAdapter.addAll(movieDetailBean.getDirectors());
    mAdapter.addAll(movieDetailBean.getCasts());
    binding.xrvCast.setAdapter(mAdapter);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:MovieDetailActivity.java

示例6: onCreate

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    Toolbar toolbar = (Toolbar) findViewById(R.id.app_bar);
    setSupportActionBar(toolbar);

    if(getSupportActionBar() != null) {
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    CategoryAdapter categoryAdapter = new CategoryAdapter(this, CategoryLogMeta.settings, CategoryLogMeta.settingsIcons, R.layout.settings_row);
    categoryAdapter.setClickListener(this);
    recyclerView.setAdapter(categoryAdapter);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(linearLayoutManager);

    //For adding dividers in the list
    DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), linearLayoutManager.getOrientation());
    dividerItemDecoration.setDrawable(ContextCompat.getDrawable(this, R.drawable.line_divider));
    recyclerView.addItemDecoration(dividerItemDecoration);
}
 
开发者ID:kunalrmhatre,项目名称:fussroll,代码行数:27,代码来源:SettingsActivity.java

示例7: initializeFormBuildHelper

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
/**
 * private method for initializing form build helper
 * @param context
 * @param recyclerView
 * @param listener
 */
private void initializeFormBuildHelper(Context context, RecyclerView recyclerView, OnFormElementValueChangedListener listener) {

    // initialize form adapter
    this.mFormAdapter = new FormAdapter(context, listener);

    // set up the recyclerview with adapter
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    linearLayoutManager.setStackFromEnd(false);

    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setAdapter(mFormAdapter);
    recyclerView.setItemAnimator(new DefaultItemAnimator());

}
 
开发者ID:adib2149,项目名称:FormMaster,代码行数:22,代码来源:FormBuilder.java

示例8: init

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void init(){
    for (int i = 0 ;i < themeType.length;i++){
        ThemeInfo info = new ThemeInfo();
        info.setName(themeType[i]);
        info.setColor(colors[i]);
        info.setSelect((selectTheme == i) ? true : false);
        if (i == themeType.length-1){
            info.setBackground(R.color.nightBg);
        }else {
            info.setBackground(R.color.colorWhite);
        }
        themeInfoList.add(info);
    }
    recyclerView = (RecyclerView)findViewById(R.id.theme_rv);
    adapter = new ThemeAdapter();
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setAdapter(adapter);

}
 
开发者ID:lijunyandev,项目名称:MeetMusic,代码行数:22,代码来源:ThemeActivity.java

示例9: onCreateView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view=inflater.inflate(R.layout.page_search_channel,container,false);
    list=view.findViewById(R.id.search_channel_list);
    LinearLayoutManager layoutManager=new LinearLayoutManager(view.getContext());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    list.setLayoutManager(layoutManager);
    Log.d("SRC onCreateView","list_layout:"+list.getLayoutManager().toString());
    channels=new ArrayList<ChannelModel>();
    list.setAdapter(new ChannelResutlAdapter(channels));
    return view;
}
 
开发者ID:toonine,项目名称:BalaFM,代码行数:14,代码来源:SearchResultChannel.java

示例10: initView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void initView() {
        recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(layoutManager);
        mCityAdapter = new CityAdapter(dataList);
        recyclerView.setAdapter(mCityAdapter);
        mCityAdapter.setOnItemClickLitener(new CityAdapter.OnItemClickLitener() {
            @Override
            public void onItemClick(View view, int position) {
                if (currentLeveL == LEVEL_PROVINCE) {
                    selectedProvince = provinceList.get(position);
                    Log.d("TAG", "QueryCity");
                    queryCity();
                } else if (currentLeveL == LEVEL_CITY) {
                    selectedCity = cityList.get(position);
                    queryCounty();
                }else if (currentLeveL == LEVEL_COUNTY){
                    String weatherId = countyList.get(position).getWeatherId();
                    Intent intent =new Intent(ChooseCity.this,MainActivity.class);
                    intent.putExtra("weather_id",weatherId);
                    startActivity(intent);
                    finish();
                }
            }
        });

//        queryProvince();
    }
 
开发者ID:linchupeng,项目名称:YourWeather,代码行数:30,代码来源:ChooseCity.java

示例11: initMainRecyclerTest

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
public void initMainRecyclerTest() {
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    bindingView.rvMain.setLayoutManager(linearLayoutManager);
    bindingView.srlSearchRefresh.setColorSchemeResources(R.color.background5, R.color.background2, R.color.background4);
    //SwipeRefreshLayout与CoordinatorLayout嵌套刷新,动态设置SwipeRefreshLayout是否可用
    bindingView.abl.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
        @Override
        public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {

            if (verticalOffset >= 0) {
                bindingView.srlSearchRefresh.setEnabled(true);
            } else {
                bindingView.srlSearchRefresh.setEnabled(false);
            }
        }
    });
    //上拉刷新
    bindingView.srlSearchRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            JZVideoPlayer.goOnPlayOnPause();
            bindingView.srlSearchRefresh.postDelayed(new Runnable() {
                @Override
                public void run() {
                    loadDetail();
                }
            }, 1000);
        }
    });
}
 
开发者ID:monkeywiiu,项目名称:Discover,代码行数:32,代码来源:SearchFragment.java

示例12: initHistoryBar

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
public void initHistoryBar()
{
    LinearLayoutManager layoutManager=new LinearLayoutManager(this.getActivity());
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    historyList.setLayoutManager(layoutManager);
    historyList.setAdapter(new SearchHistoryAdapter(this,searchModel.getHistory()));
}
 
开发者ID:toonine,项目名称:BalaFM,代码行数:8,代码来源:SearchHelpFragment.java

示例13: initView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
private void initView() {

        mRv = (RecyclerView) findViewById(R.id.rv);

        mAdapter = new SuperRecyclerAdapter<String>(this, mList) {
            @Override
            public void convert(SuperRecyclerHolder holder, final String s, int layoutType,
                final int position) {
                //只有一种布局,不使用layoutType来区分type了
                holder//
                    .setText(R.id.tv_content, s)
                    .setOnItemClickListenner(new View.OnClickListener() {
                        @Override public void onClick(View v) {
                            Toast.makeText(Btn1LayoutActivity.this, "item点击:" + s,
                                Toast.LENGTH_SHORT).show();
                        }
                    });
            }

            @Override public int getLayoutAsViewType(String s, int position) {
                return R.layout.recycler_item_btn1;
            }
        };

        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        mRv.setLayoutManager(layoutManager);
        mRv.setAdapter(mAdapter);
    }
 
开发者ID:qinxiaoguai,项目名称:SuperRecyclerViewAdapter,代码行数:30,代码来源:Btn1LayoutActivity.java

示例14: createRecyclerView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
public void createRecyclerView(int recyclerViewID) {
    recyclerView = (RecyclerView)findViewById(recyclerViewID);
    layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
}
 
开发者ID:asdiamond,项目名称:CodeMineProject1,代码行数:8,代码来源:ComputerPartActivity.java

示例15: onCreateView

import android.support.v7.widget.LinearLayoutManager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View myFragmentView = inflater.inflate(R.layout.fragment_noticias_lista, container, false);

    //Obtem da View
    mRecyclerView = (RecyclerView) myFragmentView.findViewById(R.id.rv_noticias);
    mRecyclerView.setHasFixedSize(true);

    //Define o LinearLayoutManager, que exibe os itens na vertical
    LinearLayoutManager llm = new LinearLayoutManager(getActivity());
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(llm);

    //Obtem da View
    mRelativeLayout = (RelativeLayout) myFragmentView.findViewById(R.id.pb_noticia);

    //Obtem da View
    mSwipeRefreshLayout = (SwipeRefreshLayout) myFragmentView.findViewById(R.id.srl_noticias);
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorAccent, R.color.colorPrimaryDark);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            Recarregar();
            mSwipeRefreshLayout.setRefreshing(false);
        }
    });

    //Verifica se as notícias existem
    if (mNoticias == null)
        //Baixa as notícias
        new DownloadNoticias(container.getContext(), mRelativeLayout, mRecyclerView).execute(Utils.getUrlApiNoticia(getActivity()));
    else {
        //Define o Adapter e mostra as notícias
        NoticiaAdapter n = new NoticiaAdapter(container.getContext(), mNoticias);
        mRecyclerView.setAdapter(n);
        mRecyclerView.setVisibility(View.VISIBLE);
        mRelativeLayout.findViewById(R.id.pb_noticia_indeterminate).setVisibility(View.GONE);
        mRelativeLayout.findViewById(R.id.tv_erro).setVisibility(View.GONE);
    }
    return myFragmentView;
}
 
开发者ID:alessandrojean,项目名称:order-by-android,代码行数:43,代码来源:NoticiasLista.java


注:本文中的android.support.v7.widget.LinearLayoutManager.setOrientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。