-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
29 changed files
with
774 additions
and
203 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
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/zhengsr/tabhelper/activity/VerticalTabActivity.java
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,30 @@ | ||
package com.zhengsr.tabhelper.activity; | ||
|
||
import android.graphics.Color; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
import com.zhengsr.tabhelper.R; | ||
import com.zhengsr.tablib.view.adapter.TabFlowAdapter; | ||
import com.zhengsr.tablib.view.flow.TabFlowLayout; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class VerticalTabActivity extends AppCompatActivity { | ||
private List<String> mTitle = new ArrayList<>(Arrays.asList("Life is like an ocean Only strong willed people can reach the other side i am shao rui zheng xiao yuan".split(" "))); | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_vertical_tab); | ||
TabFlowLayout flowLayout = findViewById(R.id.tabflow); | ||
flowLayout.setAdapter(new TabFlowAdapter<String>(R.layout.item_msg,mTitle) { | ||
@Override | ||
public void bindView(View view, String data, int position) { | ||
setText(view,R.id.item_text,data); | ||
} | ||
}); | ||
} | ||
} |
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,4 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="@color/black_ff_bg"/> | ||
<corners android:radius="10dp"/> | ||
</shape> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
tools:context=".activity.VerticalTabActivity"> | ||
|
||
|
||
|
||
<com.zhengsr.tablib.view.flow.TabFlowLayout | ||
android:id="@+id/tabflow" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:tab_orientation="vertical" | ||
android:background="@color/black_ff_bg" | ||
app:tab_type="round" | ||
android:paddingLeft="5dp" | ||
android:paddingRight="5dp" | ||
android:paddingTop="2dp" | ||
android:paddingBottom="2dp" | ||
app:tab_scale_factor="1.2" | ||
app:tab_item_autoScale="true" | ||
app:tab_color="@color/colorPrimary" | ||
/> | ||
|
||
</LinearLayout> |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/item_text" | ||
android:layout_width="wrap_content" | ||
tools:text="测试" | ||
android:paddingTop="6dp" | ||
android:paddingBottom="6dp" | ||
android:paddingStart="12dp" | ||
android:paddingEnd="12dp" | ||
android:textSize="14sp" | ||
android:gravity="center" | ||
android:background="#30ff0000" | ||
android:textColor="@color/wechat" | ||
android:layout_height="wrap_content"> | ||
|
||
</TextView> |
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
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
51 changes: 35 additions & 16 deletions
51
tablib/src/main/java/com/zhengsr/tablib/bean/TabValue.java
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,22 +1,41 @@ | ||
package com.zhengsr.tablib.bean; | ||
|
||
import android.graphics.RectF; | ||
import android.util.TypedValue; | ||
|
||
public class TabValue { | ||
public float left; | ||
public float right; | ||
public float left; | ||
public float top; | ||
public float right; | ||
public float bottom; | ||
|
||
public TabValue(float left, float right) { | ||
this.left = left; | ||
this.right = right; | ||
} | ||
|
||
public TabValue() { | ||
} | ||
|
||
public TabValue(float left, float right) { | ||
this.left = left; | ||
this.right = right; | ||
} | ||
@Override | ||
public String toString() { | ||
return "TabValue{" + | ||
"left=" + left + | ||
", top=" + top + | ||
", right=" + right + | ||
", bottom=" + bottom + | ||
'}'; | ||
} | ||
|
||
public TabValue() { | ||
} | ||
public RectF valueToRect(){ | ||
return new RectF(left,top,right,bottom); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "TabValue{" + | ||
"left=" + left + | ||
", right=" + right + | ||
'}'; | ||
} | ||
} | ||
public TabValue rectToValue(RectF rectF){ | ||
left = rectF.left; | ||
top = rectF.top; | ||
right = rectF.right; | ||
bottom = rectF.bottom; | ||
return this; | ||
} | ||
} |
Oops, something went wrong.