# FocusLayoutManager **Repository Path**: HarmonyOS-tpc/FocusLayoutManager ## Basic Information - **Project Name**: FocusLayoutManager - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-17 - **Last Updated**: 2023-04-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # FocusLayoutManager RecyclerView-LayoutManager for horizontal/vertical scrolling of the focused item. ## Usage Instructions ### Library Dependencies FocusLayoutManager is dependent on recyclercomponent. SHOWING DATA WITH STACKING HORIZONTAL (LEFT/RIGHT) DIRECTION Create xml code as below : Create java code as below : focusLayoutManager.setFocusOrientation(FocusLayoutManager.FOCUS_LEFT); recyclerView.setLayoutConfig(new ComponentContainer.LayoutConfig(HarmonyConstant.getMaximumWindowMetrics(this).getWidth(), HarmonyConstant.getMaximumWindowMetrics(this).getHeight() / 4)); recyclerView.setAdapter(new Adapter(this, datas = getDatas( false))); ![Image](/image/screen_horizontal.png) SHOWING DATA WITH STACKING VERTICAL (T0P/BOTTOM) DIRECTION Create xml code as below : Create java code as below : focusLayoutManager.setFocusOrientation(FocusLayoutManager.FOCUS_TOP); recyclerView.setLayoutConfig(new ComponentContainer.LayoutConfig(HarmonyConstant.getMaximumWindowMetrics(this).getWidth()/4, HarmonyConstant.getMaximumWindowMetrics(this).getHeight() / 2)); recyclerView.setMarginsLeftAndRight(400, 500); recyclerView.setAdapter(new Adapter(this, datas = getDatas(true))); Setting normal and common view gap Add below java api : focusLayoutManager.setLayerPadding(dp2px(this, count)); focusLayoutManager.setNormalViewGap(dp2px(this, count)); Setting max layer count Add below java api : focusLayoutManager.setMaxLayerCount(count); ## Installation Tutorial Solution 1: local har package integration, Add the .har package to the lib folder. Add the following code to the gradle of the entry: dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) } Solution 2: Add following dependencies in your build.gradle: Gradle dependencies { implementation project(':focuslayoutmanager') implementation fileTree(dir: 'libs', include: ['*.jar', '*.har']) }