How to get the navigation drawer below the action bar, not below of the tab bar - tabs

I am getting my navigation drawer below the tab bar but I want it to be below the title bar or action bar.
The second problem is when Navigation drawer is opened, even if we click on the tabs it is changing fragments. I want tabs click should be disable, when Navigation drawer is opened
Here is my main_layout.xml
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
<android.support.design.widget.TabLayout
android:id="#+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMode="fixed" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:textAlignment="center"
tools:openDrawer="start">
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:contextClickable="false"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
I have tried placing viewpager element above the drawerlayout even though I am getting same problem.
Here is my emulator output screenshot

Use drawer layout over action bar as usual but insert android:paddingTop="?attr/actionBarSize" line to drawerLayout tag... Or move tabLayout tag to below navigationView tag

Related

2 mutual exclusively rendered command buttons in form, only 1 working

In my login.xhtml file I have 1 form. This form also contains 2 <p:commandButton> which are mutual exclusively rendered.
The actions point to 2 different methods defined in my LoginController Java-class.
When the command button with the loginController.login action is clicked, the corresponding method in my LoginController is called as exptected.
But when the command button with the loginController.resetpassword action is clicked, the corresponding method in my LoginController is not called. The LoginController is just being reloaded and then nothing else (attempt #1).
First, I thought it's because I cannot have 2 command buttons in the same form, even though only 1 of them is rendered at any time, but if I swap the actions of the two action buttons, then the loginController.resetpassword is being called (attempt #2)! It does not matter if I swap the lines of code, so the lines of codes with the command buttons are read in another order (attempt #3).
For some readon, it seems as if I can only get the command button with id=loginButton to work?
I do not use navigation in my faces-config.xml. The form element is of type <h:form>
What am I doing wrong? Java 8, Primefaces 6.1
Attempt#1: default code
<p:commandButton id="resetpasswordButton"
value="#{msg['reset_password']}"
action="#{loginController.resetpassword}"
rendered="${not empty param.pw_reset}"
/> <!-- #resetpasswordButton button does not work -->
<p:commandButton id="loginButton"
value="#{msg['login']}"
action="#{loginController.login}"
rendered="${empty param.pw_reset}"
/> <!-- #loginButton button works, calling login() -->
Attempt#2: actions switched
<p:commandButton id="resetpasswordButton"
value="#{msg['reset_password']}"
action="#{loginController.login}"
rendered="${not empty param.pw_reset}"
/> <!-- #resetpasswordButton button does not work -->
<p:commandButton id="loginButton"
value="#{msg['login']}"
action="#{loginController.resetpassword}"
rendered="${empty param.pw_reset}"
/> <!-- #loginButton button works, calling resetpassword() -->
Attempt#3: order switched
<p:commandButton id="loginButton"
value="#{msg['login']}"
action="#{loginController.login}"
rendered="${empty param.pw_reset}"
/> <!-- #loginButton button works, calling login() -->
<p:commandButton id="resetpasswordButton"
value="#{msg['reset_password']}"
action="#{loginController.resetpassword}"
rendered="${not empty param.pw_reset}"
/> <!-- #resetpasswordButton button does not work -->

How to arrange two textviews(First textview should be at left side of screen& Second textview should be at center of screen) in android

I want to arrange the text views as per following way:
First text view should be left side of screen.
Second text view should be center of screen.
Currently i am using the relative layout and following is the code and sample image screen shot.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:id="#+id/header_layout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text1"
android:id="#+id/back_navigation"
android:drawablePadding="10dp"
android:paddingRight="5dp"
style="#style/LargeTextSizeStyle.Bold.CeruleanColor"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Text2"
style="#style/LargeTextSizeStyle.Bold.CeruleanColor"/>
Layout sample screen shot
The text views are arranged properly if they have small length of texts. But issue is two text views are overlapping to each other when they have big length of texts.
Can you please suggest me to solve the issue
You should change wrap_content to a fixed number,like :
<com.gui.home.ui.customviews.CustomTextView
android:layout_width="100dp"
android:layout_height="100dp"
android:text="Text1"
android:id="#+id/back_navigation"
android:drawablePadding="10dp"
android:paddingRight="5dp"
style="#style/LargeTextSizeStyle.Bold.CeruleanColor"/>

Change Theme in Avalon Dock

I am using Xceed.Wpf.AvalonDock in my WPF application.
I want a feature on the start page of my application which gives users an option to change the theme of the application by a click of a button/link.
Any suggestions how to do this?
Currently, I am using following code in XAML to set the Aero theme:
<avalonDock:DockingManager.Theme>
<avalonDock:AeroTheme/>
</avalonDock:DockingManager.Theme>
You can add a combo box which contains theme names, also each item's Tag is filled with its associated theme name:
<ComboBox>
<ComboBoxItem Content="Generic" />
<ComboBoxItem Content="Aero">
<ComboBoxItem.Tag>
<xcad:AeroTheme />
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="VS2010">
<ComboBoxItem.Tag>
<xcad:VS2010Theme />
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="Metro">
<ComboBoxItem.Tag>
<xcad:MetroTheme />
</ComboBoxItem.Tag>
</ComboBoxItem>
</ComboBox>
Then these tag names in items are used for binding to the Theme property in DockingManager:
<xcad:DockingManager Theme="{Binding ElementName=_themeCombo, Path=selectedItem.Tag}">
You can set the theme fix like this:
<xcad:DockingManager Grid.Row="1" MaxHeight="425"
AllowMixedOrientation="True"
BorderBrush="Black"
BorderThickness="1"
>
<xcad:DockingManager.Theme>
<xcad:MetroTheme />
</xcad:DockingManager.Theme>
</xcad:DockingManager>
You should be able to do this with a binding like any other property:
<avalonDock:DockingManager Theme="{Binding ThemeProperty}">
...
</avalonDock:DockingManager>
And then in your code just make your button or whatever control you use change ThemeProperty

How to create a tvml drop-down menu?

I want to build a TVML template that contains a Dropdown-Menu like the "All Genres" selection in the "New" tab in Apple Music.
The button is implemeted as described in Apples TVML Catalog:
<separator>
<button>
<text>Options <badge class="customBadgeLayout" src="resource://button-dropdown" width="31" height="14" /></text>
</button>
</separator>
But how can I open a list with selectable and also clickable items by clicking on the button?
Have you installed the sample TVML Catalog App?
There are good samples of templates there.
You can probably use the alertTemplate with multiple buttons, like this:
<document>
<alertTemplate>
<background>
<img src="/resources/images/background/bg_dark.jpg" />
</background>
<title>Title</title>
<button>
<text>Button 1</text>
</button>
<button>
<text>Button 2</text>
</button>
</alertTemplate>
</document>

How to create custom top links in magento?

I am trying to create custom top links.
I do not have idea of how to place block in page.xml and any other layout file.
I do not have idea of how Magento default top links work.
If I want to create custom top links what should I do?
Add this code in page.xml
it should be child block of header block.
<block type="page/template_links" name="customlinks" as="customlinks"/>
Add this code in customer.xml
<default>
<reference name="customlinks">
<action method="addLink" translate="label title" module="customer">
<label>Register</label>
<url helper="customer/getAccountUrl"/>
<title>Register</title>
<prepare/>
<urlParams/>
<position>10</position>
</action>
</reference>
</default>
add this code in your header.phtml file
<?php echo $this->getChildhtml('customlinks') ?>
it will display link 'Register'