android


How to achieve this layout on tablet?


I'm trying to create a good UI interface for tablet / large screen device.
The perfect solution would be the one running on GMail app (see screenshot below).
As far as I can understand, the layout is composed like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<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.AppBarLayout>
<include layout="#layout/activity_main_twopane" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
android:src="#drawable/ic_add" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
But if I adopt my solution, this will give me to 2 problems:
The FloatingActionButton on my code is on the bottom|end of the layout; in GMail app this is positioned only on the list layout (the one which contains e-mails);
The Toolbar on my code is only one (and I have a search action too), but it seems that on GMail app there are 2 of them: one as main with search option and the second one for details actions that are visible when you select an email.
Any advice that will lead me to to achieve the layout on screenshot?
Quick answer for your question 2 and 3:
In order to place the FAB in the desired place you have to add this tag on FloatingActionButton xml code: app:layout_anchor="#id/desired_view_id" and app:layout_anchorGravity="bottom|right|end";
In bottom toolbar you can define separate toolbar and style it.
See code below
// this is top toolbar
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top);
setSupportActionBar(toolbarTop);
// this is bottom one
Toolbar toolbarBottom = (Toolbar) findViewById(R.id.toolbar_bottom);
toolbarBottom.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
#Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()){
case R.id.action_settings:
// TODO
break;
// TODO: Other cases
}
return true;
}
});
// Inflate a menu to be displayed in the toolbar
toolbarBottom.inflateMenu(R.menu.menu_main);

Related Links

django, using session in web for the first time
URL validation works fine but keep connection and restrict any further requests
AsyncTask to call another function within class
Android Fragment Error
Error on using proguard with Android Facebook sdk 3.0
How can I fold all ChildView Group in Android ExpandableList Item?
Can't parse json string retrieved from server in android but can parse as string defined in android
Universal Image Loader using 2 displayer
Error trying to insert a new object into app engine database
How to progammicaly open context menu?
How to set minimum DatePicker date to current date
Depth map from HTC EVO 3D
selector is in different size than a “normal” image
Can we create application shortcut with user specified image file (typically SD Card) as ICON
how to lauch fragmentActivity as part of screen if i click on listview in android
Android versions clarification

Categories

HOME
shell
wakanda
rdbms
angular2-material
apache-spark-mllib
serialization
socket.io
pdfbox
seo
yandex
visual-studio-emulator
jetty
data-visualization
google-cloud-datalab
bing-maps
spin
mql5
pcl-crypto
reactive-programming
siddhi
windows-ce
endpoint
nancy
dynamic-sql
mathprog
chargify
sencha-touch
libigl
backpack-for-laravel
object-storage
xunit
custom-post-type
intersystems-cache
android-things
user-defined-functions
mql
twiml
nsurl
autodesk-designautomation
python-2.6
sql-server-2000
git-squash
laravel-eloquent
fiware-cygnus
sim-toolkit
reason
reactivekit
jvmti
news
setup.py
wmp
vaadin-charts
magento-2.0.7
cnc
rserve
trojan
amq
qtranslate
otp
janus
cd-burning
vibrate
change-tracking
docpad
cudd
mapxtreme
ziparchive
neon
signalr.client
mta
bizagi
aspen
cycle2
piracy-prevention
terracotta
themoviedb-api
extjs-grid
page.js
sapscript
sony-lifelog-api
uncompress
avahi
keyup
exceldatareader
mass-assignment
ejb-2.x
cosine-similarity
contrast
machine-instruction
linkedin-jsapi
rmysql
codeplex
malformedurlexception
jjaql
dct
radiant
zope.interface
garbage
josql
luabind
flex-mobile
workflow-services
exponentiation
jqote
drawtobitmap
massive
django-paypal
twitterizer
svk
aspmenu
isapi-extension
opml
cfwindow
build-environment

Resources

Encrypt Message