I want to create a search bar for my app. The app has many activities linked via buttons for each activity. I want a search bar to search for those buttons in order to open that activity. The search bar should be placed in the title bar. If searched for the text on the button only that button should be shown...plz help...new to android development
Use a list view with button effect instead of buttons. You can then filter the array list you are passing to the list view.
Related
I want to create a tabbed activity or empty activity in Android Studio, but I need to be able to swipe to a page 2.
All I would like is for the app to say the standard "Hello World" on the 1st screen, and then you can swipe to the next page that says "Hello World Page 2", Just those 2 screens with no title bar on any of the screens - that's it.
I've tried creating a tabbed activity and was able to create both pages and swipe works, but it creates a button in the lower right corner and a title bar with settings button up top that I couldn't figure out how to delete.
I tried an empty activity but couldn't figure out how to add another page. If anyone could provide me the code or a sample project I could edit that would be amazing as I've lost several days in frustration over this.
You can use ViewPager component. When you will use it you would to use TabLayout, but if you want to hide it you just simply can edit its visibility.
You Can try this Example.
https://www.sitepoint.com/using-viewpager-to-create-a-sliding-screen-ui-in-android/
Simply replace the image with TextView.
To hide the actionbar user getSupportActionBar().hide()
I try to put the bottom navigation bar under Google Map and I can't. When I tap the second button of navigation bar I want to open google map fragment but the bar stays at the bottom. Does anyone know how it can be done?
Here is an example of exactly what I want:
My app uses a bottom navigation layout and loads up three fragments (on one of them is a google map fragment), hence the bottom navigation menu stays there for all the three fragment of the app!
If you want to have a screen where the bottom navigation isn't present, why not use an activity with a layout without a bottom navigation view for that screen ? The user will just navigate back to the previous activity when the job is done.
I have an app where I want to be able to show a TextView
that allows the user to select some text if a user selected some text need to display custom menu. Example: custom search and Google search... .
I can intercept long-press to show my own action menu like. Reference text::: An ActionBar is located at the top of an activity and it can display any number of status or navigation related elements such as title, icon, buttons, or arbitrary action-related views.
If I select text "An ActionBar is located at" Then I need a menu like that text need to search in Google search or Wikipedia search.
Need code for this requirement.
I want to have a CustomView on my ActionBar that will define buttons, logos, etc. But I also want to make use of the Home Button and the ability to search in the ActionBar via a Search Interface. Is it possible to add, i.e. Home Button with icon on an ActionBar with Custom view layout?
Thanks
It is certainly possible to use a custom view on the action bar. The Strava android app does just that (or at least gives the appearance of an action bar at the top that has a non-standard layout).
Addressing your requirements one at a time: You can inflate a view of your own and assign it to the action bar:
View customView= getLayoutInflater().inflate(R.layout.customView, null);
getSupportActionBar().setCustomView(customView);
What you put in your view is, naturally, entirely up to you but you will have to manage everything yourself, including the home button actions. This includes the icon and text for the home button on the left hand side and search functionality. On a small device (especially in portrait mode) I'd go for a search icon only but on devices with more real estate you could fit a text input field in as well, using the alternative layouts feature to automatically pick up the most appropriate view for the device.
I know that I can get current views of a screen using getViews, I can then assert them or send appropriate commands.
But can I also get similar views for menu items? May be a list of views for the menu using robotium?
Thanks.