Some layout improvements

This commit is contained in:
tom79 2017-08-24 18:05:57 +02:00
parent f8ad45bc9c
commit c3bd364543
2 changed files with 50 additions and 42 deletions

View File

@ -158,8 +158,12 @@ public class MainActivity extends AppCompatActivity
tabLayout = (TabLayout) findViewById(R.id.tabLayout);
TabLayout.Tab tabHome = tabLayout.newTab();
TabLayout.Tab tabNotif = tabLayout.newTab();
TabLayout.Tab tabLocal = tabLayout.newTab();
TabLayout.Tab tabPublic = tabLayout.newTab();
tabHome.setCustomView(R.layout.tab_badge);
tabNotif.setCustomView(R.layout.tab_badge);
tabLocal.setCustomView(R.layout.tab_badge);
tabPublic.setCustomView(R.layout.tab_badge);
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
ImageView iconHome = (ImageView) tabHome.getCustomView().findViewById(R.id.tab_icon);
@ -169,13 +173,23 @@ public class MainActivity extends AppCompatActivity
ImageView iconNotif = (ImageView) tabNotif.getCustomView().findViewById(R.id.tab_icon);
iconNotif.setImageResource(R.drawable.ic_notifications_tl);
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
ImageView iconLocal = (ImageView) tabLocal.getCustomView().findViewById(R.id.tab_icon);
iconLocal.setImageResource(R.drawable.ic_action_users_tl);
@SuppressWarnings("ConstantConditions") @SuppressLint("CutPasteId")
ImageView iconGlobal = (ImageView) tabPublic.getCustomView().findViewById(R.id.tab_icon);
iconGlobal.setImageResource(R.drawable.ic_action_globe_tl);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_home_tl,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_notifications_tl,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_users_tl,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_globe_tl,R.color.dark_text);
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
tabLayout.setTabMode(TabLayout.MODE_FIXED);
TabLayout.Tab tabLocal = tabLayout.newTab();
tabLocal.setIcon(R.drawable.ic_action_users_tl);
TabLayout.Tab tabPublic = tabLayout.newTab();
tabPublic.setIcon(R.drawable.ic_action_globe_tl);
tabLayout.addTab(tabHome);
tabLayout.addTab(tabNotif);
tabLayout.addTab(tabLocal);

View File

@ -43,47 +43,41 @@
android:theme="@style/AppThemeDark_NoActionBar"
app:popupTheme="?attr/popupOverlay">
<LinearLayout
android:id="@+id/toolbar_search_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/toolbar_search_container"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/pp_actionBar"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:textSize="16sp"
android:id="@+id/toolbar_title" />
<android.support.v7.widget.SearchView
android:background="@null"
android:id="@+id/toolbar_search"
android:gravity="end"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="25dp"
app:tabSelectedTextColor="?attr/colorAccent"
/>
android:layout_height="40dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/pp_actionBar"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:textSize="16sp"
android:id="@+id/toolbar_title" />
<android.support.v7.widget.SearchView
android:background="@null"
android:id="@+id/toolbar_search"
android:gravity="end"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="25dp"
app:tabSelectedTextColor="?attr/colorAccent"
/>
</android.support.design.widget.AppBarLayout>