<\/a><\/p>\nThere are several NavigationTabBar elements in frames in the markup file. Here you can visually see how different attributes affect the display of the panel on the screen.\n<\/p>
<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"match_parent\"\n android:background=\"#423752\"\n android:orientation=\"vertical\"\n android:weightSum=\"2\">\n\n <LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\"\n android:orientation=\"horizontal\"\n android:weightSum=\"3\">\n\n <FrameLayout\n android:layout_width=\"0dp\"\n android:layout_height=\"match_parent\"\n android:layout_weight=\"1\"\n android:padding=\"10dp\">\n\n <devlight.io.library.ntb.NavigationTabBar\n android:id=\"@+id\/ntb_sample_1\"\n android:layout_width=\"80dp\"\n android:layout_height=\"match_parent\"\n android:layout_gravity=\"center\"\n app:ntb_bg_color=\"#605271\"\n app:ntb_active_color=\"#000\"\n app:ntb_scaled=\"false\"\n app:ntb_inactive_color=\"#fff\"\n app:ntb_animation_duration=\"1000\"\/>\n\n <\/FrameLayout>\n\n <FrameLayout\n android:layout_width=\"0dp\"\n android:layout_height=\"match_parent\"\n android:layout_weight=\"1\"\n android:padding=\"10dp\">\n\n <devlight.io.library.ntb.NavigationTabBar\n android:id=\"@+id\/ntb_sample_2\"\n android:layout_width=\"50dp\"\n android:layout_height=\"match_parent\"\n android:layout_gravity=\"center\"\n app:ntb_bg_color=\"#d78cd3\"\n app:ntb_active_color=\"#d78cd3\"\n app:ntb_inactive_color=\"#d78cd3\"\/>\n\n <\/FrameLayout>\n\n <FrameLayout\n android:layout_width=\"0dp\"\n android:layout_height=\"match_parent\"\n android:layout_weight=\"1\"\n android:padding=\"10dp\">\n\n <devlight.io.library.ntb.NavigationTabBar\n android:id=\"@+id\/ntb_sample_3\"\n android:layout_width=\"60dp\"\n android:layout_height=\"match_parent\"\n android:layout_gravity=\"center\"\n app:ntb_bg_color=\"#00000000\"\n app:ntb_corners_radius=\"10dp\"\n app:ntb_inactive_color=\"#000\"\n app:ntb_preview_colors=\"@array\/red_wine\"\/>\n\n <\/FrameLayout>\n\n <\/LinearLayout>\n\n <LinearLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\"\n android:orientation=\"vertical\"\n android:weightSum=\"3\">\n\n <FrameLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\"\n android:padding=\"10dp\">\n\n <devlight.io.library.ntb.NavigationTabBar\n android:id=\"@+id\/ntb_sample_4\"\n android:layout_width=\"match_parent\"\n android:layout_height=\"80dp\"\n android:layout_gravity=\"center\"\n app:ntb_bg_color=\"#00FFFFFF\"\n app:ntb_active_color=\"#be7818\"\n app:ntb_inactive_color=\"#be7818\"\n app:ntb_animation_duration=\"1000\"\/>\n\n <\/FrameLayout>\n\n <FrameLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\"\n android:padding=\"10dp\">\n\n <devlight.io.library.ntb.NavigationTabBar\n android:id=\"@+id\/ntb_sample_5\"\n android:layout_width=\"200dp\"\n android:layout_height=\"50dp\"\n android:layout_gravity=\"center\"\n app:ntb_animation_duration=\"400\"\n app:ntb_preview_colors=\"@array\/red_wine\"\n app:ntb_corners_radius=\"25dp\"\n app:ntb_scaled=\"false\"\n app:ntb_active_color=\"#8d88e4\"\n app:ntb_inactive_color=\"#dddfec\"\n app:ntb_bg_color=\"#8d88e4\"\/>\n\n <\/FrameLayout>\n\n <FrameLayout\n android:layout_width=\"match_parent\"\n android:layout_height=\"0dp\"\n android:layout_weight=\"1\"\n android:padding=\"10dp\">\n\n <devlight.io.library.ntb.NavigationTabBar\n android:id=\"@+id\/ntb_sample_6\"\n android:layout_width=\"240dp\"\n android:layout_height=\"60dp\"\n android:layout_gravity=\"center\"\n app:ntb_bg_color=\"#4b405c\"\n app:ntb_corners_radius=\"4dp\"\n app:ntb_preview_colors=\"@array\/polluted_waves\"\/>\n\n <\/FrameLayout>\n\n <\/LinearLayout>\n\n<\/LinearLayout>\n<\/pre>\nIn the Activity class, you can see the implementation code for each individual NavigationTabBar element.\n<\/p>
package devlight.io.sample;\n\nimport android.app.Activity;\nimport android.graphics.Color;\nimport android.os.Bundle;\nimport android.support.v4.graphics.ColorUtils;\nimport android.widget.Toast;\n\nimport devlight.io.library.ntb.NavigationTabBar;\n\nimport java.util.ArrayList;\n\n\/**\n * Created by GIGAMOLE on 28.03.2016.\n *\/\npublic class SamplesNtbActivity extends Activity {\n\n @Override\n protected void onCreate(final Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_samples_ntb);\n initUI();\n }\n\n private void initUI() {\n final NavigationTabBar ntbSample1 = (NavigationTabBar) findViewById(R.id.ntb_sample_1);\n final ArrayList<NavigationTabBar.Model> models1 = new ArrayList<>();\n models1.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_first), Color.WHITE\n ).build()\n );\n models1.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_second), Color.LTGRAY\n ).build()\n );\n models1.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_third), Color.GRAY\n ).build()\n );\n models1.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fourth), Color.DKGRAY\n ).build()\n );\n ntbSample1.setModels(models1);\n\n final NavigationTabBar ntbSample2 = (NavigationTabBar) findViewById(R.id.ntb_sample_2);\n final ArrayList<NavigationTabBar.Model> models2 = new ArrayList<>();\n models2.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_seventh), Color.YELLOW\n ).build()\n );\n models2.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_sixth), Color.YELLOW\n ).build()\n );\n models2.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fifth), Color.YELLOW\n ).build()\n );\n models2.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_eighth), Color.YELLOW\n ).build()\n );\n models2.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_second), Color.YELLOW\n ).build()\n );\n ntbSample2.setModels(models2);\n ntbSample2.setModelIndex(3, true);\n\n final NavigationTabBar ntbSample3 = (NavigationTabBar) findViewById(R.id.ntb_sample_3);\n final ArrayList<NavigationTabBar.Model> models3 = new ArrayList<>();\n models3.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_seventh), Color.RED\n ).build()\n );\n models3.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_seventh), Color.RED\n ).build()\n );\n models3.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_seventh), Color.RED\n ).build()\n );\n ntbSample3.setModels(models3);\n ntbSample3.setModelIndex(1, true);\n\n final NavigationTabBar ntbSample4 = (NavigationTabBar) findViewById(R.id.ntb_sample_4);\n final int bgColor = Color.parseColor(\"#423752\");\n final ArrayList<NavigationTabBar.Model> models4 = new ArrayList<>();\n models4.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fifth), bgColor\n ).build()\n );\n models4.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_first), bgColor\n ).build()\n );\n models4.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fourth), bgColor\n ).build()\n );\n models4.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_sixth), bgColor\n ).build()\n );\n models4.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_third), bgColor\n ).build()\n );\n ntbSample4.setModels(models4);\n ntbSample4.setModelIndex(2, true);\n\n final NavigationTabBar ntbSample5 = (NavigationTabBar) findViewById(R.id.ntb_sample_5);\n final ArrayList<NavigationTabBar.Model> models5 = new ArrayList<>();\n models5.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fifth), Color.WHITE\n ).build()\n );\n models5.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_first), Color.WHITE\n ).build()\n );\n models5.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fourth), Color.WHITE\n ).build()\n );\n models5.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_sixth), Color.WHITE\n ).build()\n );\n ntbSample5.setModels(models5);\n ntbSample5.setModelIndex(2, true);\n ntbSample5.setOnTabBarSelectedIndexListener(new NavigationTabBar.OnTabBarSelectedIndexListener() {\n @Override\n public void onStartTabSelected(final NavigationTabBar.Model model, final int index) {\n\n }\n\n @Override\n public void onEndTabSelected(final NavigationTabBar.Model model, final int index) {\n Toast.makeText(SamplesNtbActivity.this, String.format(\"onEndTabSelected #%d\", index), Toast.LENGTH_SHORT).show();\n }\n });\n\n final NavigationTabBar ntbSample6 = (NavigationTabBar) findViewById(R.id.ntb_sample_6);\n final ArrayList<NavigationTabBar.Model> models6 = new ArrayList<>();\n models6.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fifth), randomColor()\n ).build()\n );\n models6.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_first), randomColor()\n ).build()\n );\n models6.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_fourth), randomColor()\n ).build()\n );\n models6.add(\n new NavigationTabBar.Model.Builder(\n getResources().getDrawable(R.drawable.ic_sixth), randomColor()\n ).build()\n );\n ntbSample6.setModels(models6);\n }\n\n private int randomColor() {\n float[] TEMP_HSL = new float[]{0, 0, 0};\n float[] hsl = TEMP_HSL;\n hsl[0] = (float) (Math.random() * 360);\n hsl[1] = (float) (40 + (Math.random() * 60));\n hsl[2] = (float) (40 + (Math.random() * 60));\n return ColorUtils.HSLToColor(hsl);\n }\n}\n<\/pre>\nThis was an overview of how to implement the NavigationTabBar library from the Devlight development team.[:]<\/p>","protected":false},"excerpt":{"rendered":"
[:ru]\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u043c \u0432\u044b\u043f\u0443\u0441\u043a\u0435 \u0414\u0438\u0437\u0430\u0439\u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0431\u0437\u043e\u0440 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b DevLight. \u041a\u0442\u043e \u043d\u0435 \u0432 \u043a\u0443\u0440\u0441\u0435, \u044d\u0442\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0438 \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0441 \u0443\u0440\u043e\u043a\u043e\u0432 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0444\u0438\u0440\u043c\u0430 \u0438 \u043a\u0440\u0443\u0442\u044b\u0435 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0438. \u0418\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0441 \u0440\u0435\u0431\u044f\u0442\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435. \u0420\u0435\u0431\u044f\u0442\u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043e \u0442\u043e\u043c, \u0447\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0438\u0433\u043b\u0438 \u0438 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u0441\u0435\u043a\u0440\u0435\u0442\u0430\u043c\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u0443\u0441\u043f\u0435\u0445\u0430 \u0441 […]<\/p>\n","protected":false},"author":1,"featured_media":5381,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[3,63,42,19,14,25],"_links":{"self":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/5679"}],"collection":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/comments?post=5679"}],"version-history":[{"count":5,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/5679\/revisions"}],"predecessor-version":[{"id":9528,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/posts\/5679\/revisions\/9528"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media\/5381"}],"wp:attachment":[{"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/media?parent=5679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/categories?post=5679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fandroid.info\/wp-json\/wp\/v2\/tags?post=5679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}