Custom footer bar in android - android

In my android app I am trying to develop this fixed footer bar layout. Desired Footer Layout
I have written this code in my layout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#android:color/transparent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center|bottom"
android:layout_gravity="bottom"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/appheader"
android:gravity="center|bottom"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/create_poll_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|bottom"
android:src="#drawable/createpoll_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Create"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/appheader"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/corporate_corner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/brands" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Brands"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/fox_feed_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/feed_new_new" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/appheader"
android:layout_gravity="bottom"
android:gravity="center"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/leader_board_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/leaderboard_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Leaders"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/appheader"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/interest_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/interests_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Interests"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
But from this code I am getting this result.
Resulted LAyout
Please someone help as I am new in android development.

try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="#android:color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/appheader"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center|bottom"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/appheader"
android:gravity="center|bottom"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/create_poll_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|bottom"
android:src="#drawable/createpoll_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Create"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/appheader"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/corporate_corner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/brands" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Brands"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/fox_feed_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/feed_new_new" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/appheader"
android:layout_gravity="bottom"
android:gravity="center"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/leader_board_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/leaderboard_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Leaders"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#color/appheader"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/size_2">
<ImageView
android:id="#+id/interest_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/interests_new" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/size_3"
android:text="Interests"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="#dimen/size_10" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="#color/colorPrimary"
android:orientation="horizontal">
//place your image and text view here
</LinearLayout>
</RelativeLayout>

Try this..
xml: Replace with your images/fonts/sizes/margins etc
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:baselineAligned="false"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#F86E3A"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="#android:drawable/ic_menu_myplaces"
android:gravity="center"
android:text="Create" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:drawableTop="#android:drawable/ic_menu_myplaces"
android:gravity="center"
android:text="Brands" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#F86E3A"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="25dp"
android:drawableTop="#android:drawable/ic_menu_myplaces"
android:gravity="center"
android:text="Leaderboard" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="#android:drawable/ic_menu_myplaces"
android:gravity="center"
android:text="Interests" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="#drawable/shape"
android:src="#android:drawable/ic_menu_view" />
</FrameLayout>
drawable shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
<solid android:color="#D4CB47"/>
<stroke android:width="2dp" android:color="#3771B2" />
<size android:width="80dp" android:height="80dp"/>
</shape>
Screenshot (used part of your image :P)

Related

Layout item positions and sizes get changed for different devices

I have tested my application in genymotion emulator using two Android OSs. Lollipop and Ice Cream Sandwich. Worked fine in both devices. Problem is when I tested in real devices, item positions and sizes get changed.
In my xiomi mi4c (lollipop) screen looks ok
But in micromax canves (Ice Cream Sandwich) this problem happens
I want my app look like the same as in my mi4c in every devices.
This is my xml file.
<?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_widget"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/bg_register"
android:orientation="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.ceatkelanisrilanka.dushanmadushanka.ceat.CeatMainActivity"
tools:showIn="#layout/activity_ceat_main">
<include
android:id="#+id/app_bar"
layout="#layout/app_toolbar_welcome_menu"></include>
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/firstLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp">
<LinearLayout
android:id="#+id/enMonth"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingStart="10dp">
<TextView
android:id="#+id/txtMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Month"
android:textColor="#ffffff"
android:textSize="24sp" />
<TextView
android:id="#+id/yearTextV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="year"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:id="#+id/pViewLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<com.rey.material.widget.ProgressView
android:id="#+id/pViewew"
cpd_strokeColor="#android:color/holo_red_dark"
cpd_strokeSecondaryColor="#android:color/holo_blue_bright"
cpd_strokeSize="25dp"
android:layout_width="50dp"
android:layout_height="50dp"
app:pv_autostart="true"
app:pv_circular="true"
app:pv_progressMode="indeterminate"
app:pv_progressStyle="#style/Material.Drawable.CircularProgress" />
</LinearLayout>
<LinearLayout
android:id="#+id/snMonthLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<TextView
android:id="#+id/txtMonthSn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="MonthSn"
android:textColor="#ffffff"
android:textSize="24sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/secondLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="15dp">
<com.github.lzyzsd.circleprogress.ArcProgress
android:id="#+id/arc_progress"
android:layout_width="220dp"
android:layout_height="220dp"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="vertical"
android:paddingRight="15dp"
android:paddingTop="25dp">
<com.hookedonplay.decoviewlib.DecoView
android:id="#+id/dynamicArcView"
android:layout_width="100dp"
android:layout_height="100dp"
android:padding="5dp" />
<TextView
android:id="#+id/pView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 %"
android:textColor="#4B73C4"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Precentage"
android:textColor="#4B73C4"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/thirdLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/txtMtar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Monthly Target"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/txtMAch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Achievment"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/txtPre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Percentage"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.1"
android:orientation="vertical"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/txtTarget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/txtAchievement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/txtCollection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="#+id/bTon"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Ton"
android:textColor="#color/border_gray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="#+id/bValue"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Value"
android:textColor="#color/border_gray" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="#+id/bCollection"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Collection"
android:textColor="#color/border_gray" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<fragment
android:id="#+id/fragment_navigation_drawer"
android:name="com.ceatkelanisrilanka.dushanmadushanka.ceat.fragments.NavigationDrawerFragment"
android:layout_width="#dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="#layout/fragment_navigation_drawer"
tools:layout="#layout/fragment_navigation_drawer"></fragment>
</android.support.v4.widget.DrawerLayout>
Try This:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer_layout_widget"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000"
android:orientation="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<include
android:id="#+id/app_bar"
layout="#layout/app_toolbar_welcome_menu"></include>
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/firstLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp">
<LinearLayout
android:id="#+id/enMonth"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingStart="10dp">
<TextView
android:id="#+id/txtMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Month"
android:textColor="#ffffff"
android:textSize="24sp" />
<TextView
android:id="#+id/yearTextV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="year"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:id="#+id/pViewLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<com.rey.material.widget.ProgressView
android:id="#+id/pViewew"
cpd_strokeColor="#android:color/holo_red_dark"
cpd_strokeSecondaryColor="#android:color/holo_blue_bright"
cpd_strokeSize="25dp"
android:layout_width="50dp"
android:layout_height="50dp"
app:pv_autostart="true"
app:pv_circular="true"
app:pv_progressMode="indeterminate"
app:pv_progressStyle="#style/Material.Drawable.CircularProgress" />
</LinearLayout>
<LinearLayout
android:id="#+id/snMonthLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<TextView
android:id="#+id/txtMonthSn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="MonthSn"
android:textColor="#ffffff"
android:textSize="24sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/secondLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:padding="5dp">
<com.github.lzyzsd.circleprogress.ArcProgress
android:id="#+id/arc_progress"
android:layout_width="220dp"
android:layout_height="220dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_weight=".5"
android:gravity="center"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:padding="5dp">
<com.hookedonplay.decoviewlib.DecoView
android:id="#+id/dynamicArcView"
android:layout_width="100dp"
android:layout_height="100dp"
android:padding="5dp" />
<TextView
android:id="#+id/pView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0 %"
android:textColor="#4B73C4"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Precentage"
android:textColor="#4B73C4"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/thirdLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/txtMtar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Monthly Target"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/txtMAch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Achievment"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/txtPre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Percentage"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/txtTarget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/txtAchievement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/txtCollection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:paddingTop="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="#+id/bTon"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Ton"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="#+id/bValue"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Value"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="#+id/bCollection"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="Collection"
android:textColor="#000000" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!--<fragment
android:id="#+id/fragment_navigation_drawer"
android:name="com.ceatkelanisrilanka.dushanmadushanka.ceat.fragments.NavigationDrawerFragment"
android:layout_width="#dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="#layout/fragment_navigation_drawer"
tools:layout="#layout/fragment_navigation_drawer"></fragment>-->
</android.support.v4.widget.DrawerLayout>

Specific Contents are not visible by using or by without using scrollview

Following is my xml layout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EBEBEB">
<ImageView
android:layout_width="wrap_content"
android:layout_marginTop="10dp"
android:layout_height="30dp"
android:src="#drawable/contact_us"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="left"
android:text="Contact us"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/vai" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_toEndOf="#+id/imageView"
android:layout_toLeftOf="#+id/imageView"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Worldwide"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:text="Version 1.0"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#bdb9b8">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="Group of Companies"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</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_marginTop="10dp"
android:layout_marginLeft="3dp"
android:layout_height="120dp"></android.support.v4.view.ViewPager>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#bdb9b8">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="Global Representativess"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager2"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_marginLeft="3dp"
android:layout_height="wrap_content"></android.support.v4.view.ViewPager>
<LinearLayout
android:id="#+id/last"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
</LinearLayout>
</LinearLayout>
The problem with my layout is that,
The linearlayout of id last is not fully visible.
I tried to encapsulate the entire layout within scrollview but if i do so , the second view pager is not getting visible. Is there any alternative to overcome this scenario?
Try to give Orientation to your Linear Layout. and Define it above your second View Pager your last Linear Layout. I have applied some changes to your Layout.
Refer this.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EBEBEB">
<ImageView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:gravity="left"
android:text="Contact us"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_toEndOf="#+id/imageView"
android:layout_toLeftOf="#+id/imageView"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Worldwide"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:text="Version 1.0"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#bdb9b8">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="Group of Companies"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</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="120dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="10dp"></android.support.v4.view.ViewPager>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#bdb9b8">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="Global Representativess"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<LinearLayout
android:id="#+id/last"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:weightSum="6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="AgroProducts"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="AgroProducts"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="AgroProducts"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="AgroProducts"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="AgroProducts"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="AgroProducts"
android:textColor="#000000" />
</LinearLayout>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginTop="10dp"
android:orientation="vertical"></android.support.v4.view.ViewPager>
</LinearLayout>
There is no enough space to show this layout.
if you don't use you may have to add
android:weight sum to the container layout(the biggest one)
android:weightSum="3" (for example)
Then give each child layout the value you want, but make sure the summation of all values equels the weightsum
android:layout_weight="1" (for example)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2">
< TextView />
< TextView />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#bdb9b8"
android:layout_weight="2">
<TextView/>
<TextView/>
</LinearLayout>
<LinearLayout>
Or you can use ScrollView:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EBEBEB">
<ImageView
android:layout_width="wrap_content"
android:layout_marginTop="10dp"
android:layout_height="30dp"/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="left"
android:text="Contact us"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/imageView"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Worldwide"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:text="Version 1.0"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#bdb9b8">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="Group of Companies"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</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_marginTop="10dp"
android:layout_marginLeft="3dp"
android:layout_height="120dp"></android.support.v4.view.ViewPager>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#bdb9b8">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="Global Representativess"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager2"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_marginLeft="3dp"
android:layout_height="wrap_content"></android.support.v4.view.ViewPager>
<LinearLayout
android:id="#+id/last"
android:layout_weight="1"
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AgroProducts" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
I did some changes to your code.
Check this below code :
Add ScrollView to your parent Linear layout and give layout_weight to child elements
<?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" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadingEdge="none"
android:fillViewport="true"
android:isScrollContainer="true"
android:scrollbars="none" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="11" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#EBEBEB" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:src="#drawable/contact_us" />
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:gravity="left"
android:text="Contact us"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/vai" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Worldwide"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="48dp"
android:layout_marginStart="48dp"
android:text="Version 1.0"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout >
</LinearLayout >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#bdb9b8" >
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="center"
android:gravity="center"
android:text="Group of Companies"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</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="0dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="10dp"
android:layout_weight="3" >
</android.support.v4.view.ViewPager >
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#bdb9b8" >
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="center"
android:gravity="center"
android:text="Global Representativess"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
</LinearLayout >
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="10dp"
android:layout_weight="3" >
</android.support.v4.view.ViewPager >
<LinearLayout
android:id="#+id/last"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="6" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Agro-Products" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Agro-Products" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Agro-Products" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Agro-Products" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Agro-Products" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Agro-Products" />
</LinearLayout >
</LinearLayout >
</ScrollView >
</LinearLayout >

How To manage imageviews and textview with theirs alignments?

How To manage imageviews and textview with theirs alignments ?
here is code i have tried.. i have used toolbar to achieve this but failed to achieve , can anyone tell me how to accomplish this ?
<android.support.v7.widget.Toolbar
android:background="#color/backcolor"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="8">
<TextView
android:layout_weight="2"
android:drawableTop="#drawable/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Grid"
android:textSize="15sp"
android:textColor="#color/white"
android:textStyle="bold"
/>
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
out put i want
Try this code.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 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="wrap_content"
android:layout_alignParentBottom="true"
android:background="?attr/fillColor"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Here is Screen Shot.
Try following layout:
<android.support.v7.widget.Toolbar
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="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/com_facebook_button_background_color"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Try this way it works for me
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:Fnt_Awsm_Button="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/fbutton_color_whight"
android:orientation="vertical"
android:padding="#dimen/marging_pading_8pd">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4"
android:background="#f0ff"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
use 4 textview only
[<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="#dimen/actvity1_padda" >
<TextView
android:id="#+id/main_comp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_secton8"
android:text="#string/comp" />
<TextView
android:id="#+id/main_learn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/lean_businesstip"
android:text="#string/learn" />
<TextView
android:id="#+id/main_mydoc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_increase"
android:text="#string/mydoc" />
<TextView
android:id="#+id/main_business"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_secton8"
android:text="Business" />
</LinearLayout>][1]

Not able to display buttons in the screen

I am having a screen which has many layouts having title,list view ,comment and buttons but buttons are not getting displayed at all,after list view display I am getting a huge amount of empty space after which comment is getting displayed and buttons are not seen ,this is my code.
<?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/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="12345617890" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:fontFamily="#android:color/black"
android:text="Ramakrisha Tripati" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="9876543210" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_weight="1"
android:layout_margin="10dp"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="13/1/2015" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Rohit Sharma" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="55dp"
android:orientation="horizontal"
android:background="#android:color/holo_orange_light">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item#\nstyle#"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="M Wt\nD Wt\nCS Wt"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Making\nD Rate\nCS Rate"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Margin\nDis %\nDiscount"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GT\nFSP"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="#00000000"
android:dividerHeight="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25dp"
android:text="Comment" />
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:ems="10"
android:hint="Comment goes here"
android:inputType="textMultiLine" />
</LinearLayout>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="accept"
android:src="#drawable/accept"
/>
</LinearLayout>
I have modified your layout code and now the button has appeared.
<?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:background="#android:color/white"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="12345617890" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:fontFamily="#android:color/black"
android:text="Ramakrisha Tripati" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="9876543210" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="right"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="13/1/2015" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Rohit Sharma" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="55dp"
android:background="#android:color/holo_orange_light"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="item#\nstyle#" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="M Wt\nD Wt\nCS Wt" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Making\nD Rate\nCS Rate" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Margin\nDis %\nDiscount" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="GT\nFSP" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="#00000000"
android:dividerHeight="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Comment"
android:textSize="25dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:ems="10"
android:hint="Comment goes here"
android:inputType="textMultiLine" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:onClick="accept"
android:src="#drawable/accept" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Just put your main LinearLayout inside scrollview and you will see thr buttons.
And if not so maybe your image is so small or transparent.
check with another image maybe.

Android Linear layout image with text

I am making an android app, i want to make a layout like below image.
How can i manage image and layout weight with color.
Try this..
<?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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Categories

Resources