-
Notifications
You must be signed in to change notification settings - Fork 918
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
133 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/hazz/kotlinmvp/view/TabLayoutHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.hazz.kotlinmvp.view | ||
|
||
import android.annotation.SuppressLint | ||
import android.os.Build | ||
import android.support.design.widget.TabLayout | ||
import android.widget.LinearLayout | ||
import com.hazz.kotlinmvp.utils.DisplayManager | ||
import java.lang.reflect.Field | ||
|
||
/** | ||
* Created by xuhao on 2017/12/7. | ||
* desc: | ||
*/ | ||
object TabLayoutHelper{ | ||
|
||
@SuppressLint("ObsoleteSdkInt") | ||
fun setUpIndicatorWidth(tabLayout: TabLayout) { | ||
val tabLayoutClass = tabLayout.javaClass | ||
var tabStrip: Field? = null | ||
try { | ||
tabStrip = tabLayoutClass.getDeclaredField("mTabStrip") | ||
tabStrip!!.isAccessible = true | ||
} catch (e: NoSuchFieldException) { | ||
e.printStackTrace() | ||
} | ||
|
||
var layout: LinearLayout? = null | ||
try { | ||
if (tabStrip != null) { | ||
layout = tabStrip.get(tabLayout) as LinearLayout | ||
} | ||
for (i in 0 until layout!!.childCount) { | ||
val child = layout.getChildAt(i) | ||
child.setPadding(0, 0, 0, 0) | ||
val params = LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1f) | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { | ||
params.marginStart = DisplayManager.dip2px(50f)!! | ||
params.marginEnd = DisplayManager.dip2px(50f)!! | ||
} | ||
child.layoutParams = params | ||
child.invalidate() | ||
} | ||
} catch (e: IllegalAccessException) { | ||
e.printStackTrace() | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/mRecyclerView" | ||
<com.classic.common.MultipleStatusView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/multipleStatusView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:clipToPadding="false" | ||
android:paddingBottom="@dimen/padding_tab_layout_bottom"> | ||
android:layout_height="match_parent" | ||
android:background="@color/backgroundColor" | ||
app:emptyView="@layout/layout_empty_view" | ||
app:errorView="@layout/layout_error_view" | ||
app:loadingView="@layout/layout_loading_view" | ||
app:noNetworkView="@layout/layout_network_view"> | ||
|
||
</android.support.v7.widget.RecyclerView> | ||
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/mRecyclerView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:clipToPadding="false" | ||
android:paddingBottom="@dimen/padding_tab_layout_bottom"> | ||
|
||
</android.support.v7.widget.RecyclerView> | ||
</com.classic.common.MultipleStatusView> |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,8 @@ | |
|
||
<color name="color_aquamarine">#7FFFD4</color> | ||
|
||
<color name="color_light_black">#5000</color> | ||
|
||
|
||
|
||
|
||
|