I am using https://github.com/roughike/BottomBar library to make my bottom bar
for android but i can't change the size of the icons , any idea how to make them small ?
activity_main
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="ytstudios.wall.plus.MainActivity"
android:background="#color/colorAccent">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:elevation="8dp">
</android.support.v7.widget.Toolbar>
<com.roughike.bottombar.BottomBar
android:id="#+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="#color/colorPrimary"
app:bb_tabXmlResource="#xml/bottom_tabs"
app:bb_inActiveTabColor="#color/tabSelected"
app:bb_inActiveTabAlpha="0.2"
app:bb_behavior="iconsOnly"
app:bb_activeTabColor="#color/tabSelected">
</com.roughike.bottombar.BottomBar>
The easiest way would be use Android Asset Studio tool to convert your icons according to your size
As you will reduce asset size in the tool your icon will be reduced in size and will be displayed correctly.
Related
I'm trying to make a splash screen, I'm doing that with react native, but I'm using android studio to create the style.
First of all, I'm following this video that uses this library.
I have the following code of my splash screen:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="#color/primary"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/launch_screen"
android:scaleType="centerCrop" />
</LinearLayout>
</RelativeLayout>
It looks like this:
As you can see, the quality of the logo is low, and I would like to make it better.
My drawable folder is the following:
Thanks!
It seems that your launch_screen.png file has a small resolution.
Change that file with bigger resolution with better quality.
So a noob question: I started a project with a navigation bar in Xamarin and I just want to change the default icons and change names under them in accordance with my app. Can I do that in the constructor view? The buttons themselves already do what I want them to do but I just want to change their appearance. pic activity_main.xml just in case:
<RelativeLayout 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:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/containerTwo"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="#+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#id/navigation" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
android:layout_alignParentBottom="true"
app:menu="#menu/navigation"
android:accessibilityHeading="true"
/>
</RelativeLayout>
</RelativeLayout>
Okay, I got it. What I managed to do:
Used this article
Installed Xamarin.Android.Support.Design
Downloaded desired icons from Asset Studio
Unpacked zip file with icons and placed all of the "drawable" folders in Resources\drawable
changed android:icon parameter in navigaton.xml to one of the downloaded icon names
NOTE: sometimes preview gets messed up, for example it might size icons in different scales but when you emulate the build or execute it on a real phone everything looks fine.
i want to create fixed navigation layout, but there is a problem when i rotate device, margin-top of this layout is more than it has to be, so the question - how can i find height of this dark-blue header ( to use it as margin ), or maybe there is another way
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginTop="55dp"
android:layout_height="80dp"
android:background="#drawable/panel_border"
android:layout_alignParentTop="true">
If I were you, I would go with this:
android:layout_marginTop="?attr/actionBarSize"
This attribute indicates correct height of the ActionBar / Toolbar.
The Toolbars height may be different for different APIs and that's the reason you should use ?android:attr or ?attr (when using support library).
? means that it comes from internal Android resources.
Let the android support library do it for you. Like this
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<! -- Your View -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/panel_border"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
take a look at this
In my app I want to display a simple Image,
On my Samsung Galaxy S7 Real device the image is fine, The bottom Navigation bar is not part of the view but part of the phone itself.
The whole of the Image is present.
On the Android Emulator the bottom navigation bar is part of the view and the image is partially hidden
Here is my simple Linear Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#color/md_blue_50"
android:orientation="vertical">
<include
android:id="#+id/app_bar"
layout="#layout/toolbar"/>
<ImageView
android:id="#+id/photo_image_large"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:scaleType="fitXY"/>
</LinearLayout>
Here is the Android Emulator Screenshot
android emulator
Here is my Samsung Galaxy Real Device Screenshot
android real device
The problem also occurs in recycler Views in the app the bottom part of the image is cut off on the android emulator...
It's because of android:fitSystemWindows put it to false and it should be good
I had similar problems with BottomNavigationView (menu) this is solution :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/main_activity_main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="#+id/main_activity_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
app:itemIconTint="#color/color_main_white"
app:itemTextColor="#color/color_main_white"
app:menu="#menu/bottom_navigation_menu"/>
Try to change parameter android:layout_heigh to 0dp and add this android:layout_weight="1" for ImageView
you have to place the view above the bottom navigation bar so that the view wont hide in the bottom navigation bar
I am trying to build up android app layout and my problem is that one element has some weird padding/margin and I can't find where it's been given. I triple checked my code and I'm sure that elements in my XML layout have no specific margins or padding (images attached). Is there any way to figure out what is going on? I have turned on show element borders on my device and it wasn't very helpful. I'm a beginner in the Android world and I wonder is there any specific tool to help in this kind of situation? I would be grateful for any kind of advice. Thanks!
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="#+id/monthPageTitlePageIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:clipToPadding="false"
app:backgroundTintMode="multiply"
app:tabMode="scrollable"
app:tabSelectedTextColor="#color/white" />
<android.support.v4.view.ViewPager
android:id="#+id/historyViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="AAAAAA" />
</LinearLayout>
The red line below shows the unwanted space:
The following shows the borders: