Add submenu in a Navigation Drawer - android

I'm trying to add submenu in one of item that It is in my menu like Wallapop that when click in a Item of Menu, open submenus:
This is my XML file, a simple LinerLayout with ToggleButtons to form the Menu:
<LinearLayout
android:id="#+id/linearlayout_container_menu"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:orientation="vertical">
<com.runator.ui.widget.text.CustomToggleButton
android:id="#+id/tooglebutton_menu_runsfeed"
android:textOn="#string/menu_runsfeed"
android:textOff="#string/menu_runsfeed"
android:drawableLeft="#drawable/tg_menu_runsfeed"
android:drawableStart="#drawable/tg_menu_runsfeed"
style="#style/textMenu.item"/>
<com.ui.widget.text.CustomToggleButton
android:id="#+id/tooglebutton_menu_leaderboards"
android:textOn="#string/menu_leaderboards"
android:textOff="#string/menu_leaderboards"
android:drawableLeft="#drawable/tg_menu_leaderboards"
android:drawableStart="#drawable/tg_menu_leaderboards"
style="#style/textMenu.item"/>
<com.ui.widget.text.CustomToggleButton
android:id="#+id/tooglebutton_menu_runators"
android:textOn="#string/menu_runators"
android:textOff="#string/menu_runators"
android:drawableLeft="#drawable/tg_menu_runators"
android:drawableStart="#drawable/tg_menu_runators"
style="#style/textMenu.item"/>
<com.ui.widget.text.CustomToggleButton
android:id="#+id/tooglebutton_menu_virtual_races"
android:textOn="#string/menu_virtual_races"
android:textOff="#string/menu_virtual_races"
android:visibility="gone"
android:drawableLeft="#drawable/tg_menu_virtual_races"
android:drawableStart="#drawable/tg_menu_virtual_races"
style="#style/textMenu.item"/>
</LinearLayout>
I do not get what makes Wallapop, if anyone has any ideas I would be very grateful.

Related

How to add menu when there is No Action Bar

I want create a menu in my application which has no action bar... I want to make it just like you can see in chrome browser... Please help me with this and sorry for I don't have any code I made for this purpose ....Thanks in advance
I don't really get what you are asking, so I will try to list all posible meanings:
Use Toolbar(ActionBar)'s menu but layout doesn't have Toolbar:
Just add a toolbar to your layout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.material.appbar.AppBarLayout>
...
</LinealLayout>
Custom Toolbar
I have never tried to inflate Menu into a non-Toolbar and I think it is not possible. Please correct me if you have tried! So I think you must implement every view/button, etc... one by one.
No toolbar, just menu (Popup ?)
https://www.geeksforgeeks.org/popup-menu-in-android-with-example/

How to make Seek bar in Slide menu?

I'm a student making an application using an android studio for practice. I want to make seek bar in basic slide menu, which android studio provides as navigation drawer. I searched about it but couldn't find it. If the answer already exists, I apologise. Pretty hard to search by English...
Is there a way to create seek bar in slide menu so users can edit the value? For instance, users can control size or opacity of pen directly by editing the value of seek bar in slide menu. I made an example image. Thanks for reading.
Modify your NavigationView to accommodate android Views instead of menu.So that you can customize the entire Navigation Drawer Menu.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/nav_header_main" />
<ListView
android:id="#+id/lst_menu_items"
android:layout_width="match_parent"
android:layout_height="0dp"
android:entries="#array/sports_array"
android:layout_weight="1" />
</LinearLayout>
</android.support.design.widget.NavigationView>

Android - Push up layout when EditText has focus

Before starting, I am sorry for the bad English, i'm French.
I have a main activity, which is a navigation bar (ActionBarActivity) whit a DrawerLayout. From this DrawerLayout, I start different Fragment, and one of them has a ViewPager.
I have 3 tab, so 3 Fragment inside. In this 3 Fragment I have a ListView, and when i click on item, an other Fragment take the place of the current Fragment on the tab.
On this new Fragment i have some elements, but the problem become from EditText. The EditText open the keyboard but i can't see what i'm tapping because he is under the keyboard.
I think the problem is the ViewPager, because when I use this Fragment from the navigation menu, I haven't this problem.
I have already try to use ScrollView, and this android:windowSoftInputMode="adjustPan"
There is my ViewPager xml :
<?xml version="1.0" encoding="utf-8"?>
<com.neden.neden.CustomViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/vpPager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.view.PagerTabStrip
android:id="#+id/pager_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#fff"
android:paddingBottom="4dp"
android:paddingTop="4dp" />
</com.neden.neden.CustomViewPager>
After searching in forum, found a solution but now, i havent notification bar.
I use this code in my main activity :
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
If you have an other solution, ...

Customise context menu like pinterest menu

I've been looking for something like Pinterest menu whenever item in GridView is pressed. I know it's too broad question. But little strike on question will provide a correct way to achieve these.
Que:
How one can implement customise context menu like Contacts+ or Pinterest Context menu on GridView item?
Tried:
ArcMenu : But they are replacement of Slider Menu or Pop up Menu for overall Application. I want menu which can be created onFly for GridView Item.
Satellite Menu : Same as ArcMenu, replacement of Slider Menu or Pop up Menu for overall Application.
Please enlighten me to achieve behaviour like these.
I think instead of Context Menu you can use PopupWindow for your requirement.
//Custom popup view
View view= layoutInflater.inflate(R.layout.popupview, null);
PopupWindow popupWindow = new PopupWindow(
view,
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
//Display popup window on clicking anything
//Displays pop up window near button with offsets 10 and -10
popupWindow.showAsDropDown(button, 10, -10);
For more info
http://developer.android.com/reference/android/widget/PopupWindow.html
http://android-er.blogspot.in/2012/03/example-of-using-popupwindow.html
Use quick action 3D view. It is the menu which is used in twitter application.
For source: https://github.com/lorensiuswlt/NewQuickAction3D
I'm using a modified version of ArcMenu (just small and mainly visual modifications) for something similar. And it's perfectly adaptable to gridview (i'm using it with StaggeredGridView onitemclick).
You only have to define it in the xml inside the gridview item with Visibility:gone and then in your gridview adapter or in the activity set it to visible when the item is touched or clicked...
don't know why you say it's for overall app, it can be used as an item element also.
You can check out this library which I created:
https://github.com/reyanshmishra/PinMenu
You can clone it and import it as a module to your app and do something like this:
In your XML layout:
<?xml version="1.0" encoding="utf-8"?>
<com.reyanshmishra.pinmenu.PinMenuHolder 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"
app:pin_holder_draw_over_view="true"
app:pin_holder_overlay_color="#90ffffff">
<com.reyanshmishra.pinmenu.PinMenu
android:id="#+id/one"
android:layout_width="48dp"
android:layout_height="48dp"
android:elevation="5dp"
android:padding="5dp"
android:scaleType="centerInside"
android:src="#drawable/ic_close_black_24dp"
app:pin_background_color="#color/white"
app:pin_name="Cancel"
app:pin_selected_color="#BD081C" />
<com.reyanshmishra.pinmenu.PinMenu
android:id="#+id/three"
android:layout_width="48dp"
android:layout_height="48dp"
android:elevation="5dp"
android:padding="5dp"
android:scaleType="centerInside"
android:src="#drawable/share_variant"
app:pin_background_color="#color/white"
app:pin_name="Share"
app:pin_selected_color="#BD081C" />
<com.reyanshmishra.pinmenu.PinMenu
android:id="#+id/four"
android:layout_width="48dp"
android:layout_height="48dp"
android:elevation="5dp"
android:padding="5dp"
android:scaleType="centerInside"
android:src="#drawable/dots_horizontal"
app:pin_background_color="#color/white"
app:pin_name="More"
app:pin_selected_color="#BD081C" />
</com.reyanshmishra.pinmenu.PinMenuHolder>
Now in Java:
PinDialog mPinDialog = new PinDialog(this);
mPinDialog.setContentView(R.layout.layout_pin_menu);
mPinDialog.setPinSelectListener(new PinSelectListener() {
#Override
public void pinSelected(PinMenu pinMenu) {
Toast.makeText(mContext, "" + pinMenu.getPinName(), Toast.LENGTH_SHORT).show();
}
});
mPinDialog.addToRecyclerView(mRecyclerView);
It's still under development so it just supports recyclerview. For depth of the implementation, you can just skim through the classes of the library. I don't think I can put all the code here.
The result it something like this:

How does overlaying views work in Android?

In Android, i noticed that you can have a fixed view on top of another. For example, when you open your browser, and tap the search box, a keyboard prompt pops up (on top of a listview). However, notice that you can still scroll up and down on the listview without the keyboard going away. Like:
would someone please explain (preferrably some sample code in addition) how this works?
What i'm trying to do is just have a custom listview that always has a floating navigation bar on top of the listview and also on the bottom of the list view (it's not actually a header/footer of the listview, it's more like a header/footer of the screen). It would be similar to the example i just described, where the user can interact with both the navigation bar as well as the listview "underneath" the nav bar.
I am somewhat new to Android development, so please be nice and provide a little bit of details if you would :) much thanks in advance!!
whoops. looks like someone had a similar issue:
Layout Layers? Z-Axis?
and this post http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-by.html explains how FrameLayout works and also how works, which is an even better alternative.
FrameLayout lays object in a different Z-axis, so this is the solution i was looking for.
There are many ways to achieve that, the simpler i can think of is using linear layout :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/header">
//Here you add whatever you want in your "header"
</LinearLayout>
//create your listview
<ListView
android:id="#+id/content_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:layout_marginRight="10dip"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:layout_marginBottom="10dip"
android:scrollbars="none"
android:paddingBottom="5dp"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/footer">
//Here you add whatever you want in your "footer"
</LinearLayout>

Categories

Resources