當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。