-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a sample for the icons only mode.
- Loading branch information
Showing
5 changed files
with
73 additions
and
0 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
39 changes: 39 additions & 0 deletions
39
app/src/main/java/com/example/bottombar/sample/IconsOnlyActivity.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,39 @@ | ||
package com.example.bottombar.sample; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.support.annotation.IdRes; | ||
import android.support.annotation.Nullable; | ||
import android.widget.TextView; | ||
import android.widget.Toast; | ||
|
||
import com.roughike.bottombar.BottomBar; | ||
import com.roughike.bottombar.OnTabReselectListener; | ||
import com.roughike.bottombar.OnTabSelectListener; | ||
|
||
public class IconsOnlyActivity extends Activity { | ||
private TextView messageView; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_icons_only); | ||
|
||
messageView = (TextView) findViewById(R.id.messageView); | ||
|
||
BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar); | ||
bottomBar.setOnTabSelectListener(new OnTabSelectListener() { | ||
@Override | ||
public void onTabSelected(@IdRes int tabId) { | ||
messageView.setText(TabMessage.get(tabId, false)); | ||
} | ||
}); | ||
|
||
bottomBar.setOnTabReselectListener(new OnTabReselectListener() { | ||
@Override | ||
public void onTabReSelected(@IdRes int tabId) { | ||
Toast.makeText(getApplicationContext(), TabMessage.get(tabId, true), Toast.LENGTH_LONG).show(); | ||
} | ||
}); | ||
} | ||
} |
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,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<TextView | ||
android:id="@+id/messageView" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_above="@+id/bottomBar" | ||
android:gravity="center" | ||
android:text="Hi mom!" /> | ||
|
||
<com.roughike.bottombar.BottomBar | ||
android:id="@+id/bottomBar" | ||
android:layout_width="match_parent" | ||
android:layout_height="60dp" | ||
android:layout_alignParentBottom="true" | ||
app:bb_tabXmlResource="@xml/bottombar_tabs_five" | ||
app:bb_behavior="iconsOnly" /> | ||
|
||
</RelativeLayout> |
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