I am new to the Android and I am working on a partially completed Android project.
In all the screens of my app there is a header bar which has the logo of the app and the app name in the left. This header is automatically added to the newly created xml files too. But I want to remove the app icon from this header bar. When I look at my .xml file I don't find any reference to the logo or the app name. I suspect the header is defined globally somewhere in the project. How do I find that in my project so that I can edit it?
I want to remove the 'SD' image from the header. Here is my xml.
<?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"
android:background="#drawable/bg_main"
tools:context=".AlbumFragment" >
<fragment
android:id="#+id/fragmentBook"
android:name="com.hcpt.course.fragment.BookFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment
android:id="#+id/fragmentBookMark"
android:name="com.hcpt.course.fragment.BookMarkFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment
android:id="#+id/fragmentSetting"
android:name="com.hcpt.course.fragment.SettingFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment
android:id="#+id/fragmentAbout"
android:name="com.hcpt.course.fragment.AboutFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
Related
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.
Screenshot was taken on Xiamoni Redmi Note5
In the emulator, this problem has not happened.
please help me.
Change your layout as follows:
<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"
tools:context=".CatalogActivity" >
<ListView
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
// etc rest if the layout is the same
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.
I am new developing in Android. I am using ADT 22.3.0 (downloaded 10 days ago).
I open a new Android proyect and when finish and activity_main is open, I cannot add nothing to it, nor items nor layout. I have read that I need a layout to add items (and my activity doesn't have one) but I cannot add a layout neither.
My project config:
minSDK: 11
targetSDK: 19
I checked action bar.
Activity_main.xml
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
</android.support.v4.view.ViewPager>
And a SnapShot:
The problem is (I think) that I checked horizontal swipe to move between tabs of action bar. This option creates a ViewPager instead a standard layout activity. I edited manually the XML to "insert" the ViewPager inside a global layout and now I can add (or move) items.
Here is the new code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="214dp"
android:layout_weight="0.36"
app:context=".MainActivity" >
</android.support.v4.view.ViewPager>
<TextView
android:id="#+id/textView1"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_weight="0.11"
android:text="TextView" />
</LinearLayout>
Can someone help me know how to place a Widget above a ActionBar in android.I have read some other similar queries on stackoverflow but it mentions its not possible.Following is the screen that i am trying to create.Can some one let me know how do i place the Blue layout portion above the actionbar?Or is there some other way of achieving this?
Following is my xml file
nearby.xml
<?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:orientation="vertical"
android:background="#android:color/black"
>
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="100dp" >
</LinearLayout>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>
</LinearLayout>
However i am not getting the desired layout.The header layout is visible below the actionbar.
Desired Layout:
The blue bar that you see is the action bar, using a custom view. Check out setCustomView on how you can customize the action bar.