I am trying to put some background color/picture behind the all Horizontal Scroll view - so that my pictures I putted there will be on back floating color
when I tried to define it (in xml) it got crazy and got spread all down the screen for some reason.. any 1 have an answer?
<LinearLayout
android:id="#+id/expandable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:orientation="horizontal">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="#+id/iv_barcelona"
android:layout_width="70dp"
android:layout_height="90dp"
android:padding="3dp"
android:src="#drawable/barcelonah" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="|"
android:textSize="45sp"
android:gravity="center"
android:padding="3dp"
android:layout_gravity="center"/>
<ImageView
android:id="#+id/iv_berlin"
android:layout_width="70dp"
android:layout_height="90dp"
android:padding="3dp"
android:src="#drawable/berlinh" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="|"
android:textSize="45sp"
android:gravity="center"
android:padding="3dp"
android:layout_gravity="center"/>
<ImageView
android:id="#+id/iv_eilat"
android:layout_width="70dp"
android:layout_height="90dp"
android:padding="3dp"
android:src="#drawable/eilath" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="|"
android:textSize="45sp"
android:gravity="center"
android:padding="3dp"
android:layout_gravity="center"/>
</LinearLayout>
</HorizontalScrollView>
Related
Im having an issue with centering my buttons and text between those buttons to center. Im not sure whats wrong, because that "Some example" text placed nicely. Is there some other "command" to use with buttons? I already tested layout_gravity:center, but that doesnt work some reason.. Anyone can help me?
Issue pic
Here is my xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:cardCornerRadius="80dp"
android:cardElevation="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="10dp"
android:text="Some example"
android:textSize="40dp" />
<TextView
android:id="#+id/kpl1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:text="10"
android:textSize="30dp"
android:textStyle="bold"
android:layout_below="#+id/text"
android:layout_gravity="center"
android:layout_toRightOf="#+id/addCount"/>
<Button
android:id="#+id/addCount"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_below="#+id/text"
android:gravity="center"
android:text="+"
android:textSize="30dp">
</Button>
<Button
android:id="#+id/delCount"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:text="-"
android:gravity="center"
android:textSize="30dp"
android:layout_below="#+id/text"
android:layout_toRightOf="#id/kpl1">
</Button>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
My code should work for you as long as you have no problem with the extra LinearLayout. I couldn't find a better way, as there seems to be no way to center multiple objects in a RelativeLayout without grouping them in a LinearLayout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:cardCornerRadius="80dp"
android:cardElevation="10dp">
</androidx.cardview.widget.CardView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="10dp"
android:text="Some example"
android:textSize="40dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/text"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="#+id/delCount"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:gravity="center"
android:text="-"
android:textSize="30dp">
</Button>
<TextView
android:id="#+id/kpl1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:text="10"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/addCount"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:gravity="center"
android:text="+"
android:textSize="30dp">
</Button>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cardCornerRadius="80dp"
android:cardElevation="10dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="10dp"
android:text="Some example"
android:textSize="40dp" />
<LinearLayout
android:orientation="horizontal"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<Button
android:id="#+id/addCount"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:gravity="center"
android:text="+"
android:textSize="30dp"/>
<TextView
android:id="#+id/kpl1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:text="10"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/delCount"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:gravity="center"
android:text="-"
android:textSize="30dp">
</Button>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
while using cardview, surround all your views in a parent linearLayout
such that you can control the view.
Hi i had to make a layout with card with recyclerview so for that i set an image as a background to linear layout but now i'm unable to center crop that image
My problem is that i cannot use imageview because using that the height of card increases as well and i don't want that so please if someone can assit me..
my xml
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/primary_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="19dp"
android:layout_marginRight="19dp"
android:layout_marginTop="15dp"
app:cardCornerRadius="115dp">
<ImageView
android:id="#+id/background_image_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:visibility="gone" />
<LinearLayout
android:id="#+id/background_image"
android:layout_width="match_parent"
android:layout_height="210dp"
android:background="#drawable/club1"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:src="#drawable/ellipse" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="#+id/first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:padding="5dp"
android:text="John Doe"
android:textColor="#color/White"
android:textSize="15sp" />
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="#+id/second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:padding="5dp"
android:text="checked in to"
android:textColor="#color/White"
android:textSize="10sp" />
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="#+id/third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:padding="5dp"
android:text="W south"
android:textColor="#color/White"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="horizontal">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="#+id/fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="9dp"
android:text="beach mumbai"
android:textColor="#color/White"
android:textSize="15sp" />
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="#+id/fifth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/second_text"
android:layout_toRightOf="#+id/fourth_text"
android:text="30 mins ago."
android:textColor="#color/White"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="85dp">
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="#+id/sixth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:padding="10dp"
android:text="reply to abc............"
android:textColor="#color/White" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true">
<ImageView
android:id="#+id/favourite_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/ic_favorite_border_black_24dp" />
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:id="#+id/seventh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:text="40 likes"
android:textColor="#color/White" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
You can't center crop a background image of linear layout,
But you can achieve the same using these changes:
Replace you LinearLayout with RelativeLayout
Place a ImageView as a first child inside relative layout and use property for center crop.
<RelativeLayout
android:id="#+id/background_image"
android:layout_width="match_parent"
android:layout_height="210dp"
android:orientation="vertical">
<ImageView
android:scaleType="centerCrop"
android:src="#drawable/club1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
.....
......
</RelativeLayout>
If you Want to control The Image View Scale
you need to put it in ImageView As Src Not Background
You can use Frame layout To Achieve it
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/primary_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="19dp"
android:layout_marginRight="19dp"
android:layout_marginTop="15dp"
app:cardCornerRadius="115dp">
<ImageView
android:id="#+id/background_image_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:visibility="gone" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="210dp">
<ImageView
android:layout_width="match_parent"
android:src="#mipmap/ic_launcher"
android:layout_height="match_parent" />
<LinearLayout
android:id="#+id/background_image"
android:layout_width="match_parent"
android:layout_height="210dp"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/profile_image"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:src="#drawable/playstore_icon" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="#+id/first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:padding="5dp"
android:text="John Doe"
android:textSize="15sp" />
<TextView
android:id="#+id/second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:padding="5dp"
android:text="checked in to"
android:textSize="10sp" />
<TextView
android:id="#+id/third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:padding="5dp"
android:text="W south"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="horizontal">
<TextView
android:id="#+id/fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="9dp"
android:text="beach mumbai"
android:textSize="15sp" />
<TextView
android:id="#+id/fifth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/second_text"
android:layout_toRightOf="#+id/fourth_text"
android:text="30 mins ago."
android:textSize="10sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="85dp">
<TextView
android:id="#+id/sixth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:padding="10dp"
android:text="reply to abc............"
android:textColor="#color/white" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true">
<ImageView
android:id="#+id/favourite_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="#drawable/ic_close" />
<TextView
android:id="#+id/seventh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:text="40 likes"
android:textColor="#color/white" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</FrameLayout>
</android.support.v7.widget.CardView>
CenterCrop logic is baked inside ImageView. The correct solution is to extract it into a Drawable which wraps another Drawable and centerCrops it.
If you use CoordinatorLayout, then just to put your ImageView with centerCrop parameter to top.
<CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:scaleType="centerCrop"
android:background="#drawable/background_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
<include layout="#layout/header_main" />
<TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="#android:color/white"
android:background="#drawable/white_border_background"
app:tabIndicatorHeight="3dp"/>
</AppBarLayout>
<ViewPager
android:id="#+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</CoordinatorLayout>
I've made a lay-out with 10 buttons. In those buttons i have icons, showing what the information inside is about. Under those buttons, I want to have a word to clearify that again.
I have no idea how to add textviews and place them exactly under those buttons. I have tried it from the lay-out, by just pressing Textview and put it under the buttons, but that way my entire lay-out goes downwards, and the position is not right under it, but slightly left of it.
Hope someone can help me, every kind of help is appreciated.
This is my layout, the red circles are where I want the text to be.
Click here to see the image
This is my code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.rodekruis.MainActivity"
android:background="#drawable/rkzafbeelding">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.rodekruis.MainActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageButton1"
android:layout_width="40dp"
android:layout_height="50dp"
android:layout_marginBottom="20dp"
android:layout_marginRight="40dp"
android:layout_marginTop="10dp"
android:layout_gravity="right"
android:src="#drawable/informatiebutton" />
<ImageView
android:layout_marginBottom="50dp"
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="1dp"
android:scaleType="fitStart"
android:src="#drawable/logoversiejuni" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="0dp"
android:orientation="horizontal">
<ImageButton
android:id="#+id/button10"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button10"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/afspraakbutton"
android:text=" Afspraak maken" />
<ImageButton
android:id="#+id/button8"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/bezoektijdenbutton"
android:text=" Bezoek tijden" />
<ImageButton
android:id="#+id/button9"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/contactbutton"
android:text=" Contact" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:orientation="horizontal">
<ImageButton
android:id="#+id/button3"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/routebutton"
android:text="Route" />
<ImageButton
android:id="#+id/button4"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/meningbutton"
android:text="Uw mening" />
<ImageButton
android:id="#+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/vriendenbutton"
android:text="Word vriend" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<ImageButton
android:id="#+id/button5"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/foldersbutton"
android:text="Folders" />
<ImageButton
android:id="#+id/button6"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/specialistenbutton"
android:text="Specialisten" />
<ImageButton
android:id="#+id/button7"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/bwcbutton"
android:text="Brandwond encentrum" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<ImageButton
android:id="#+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/nieuwsbutton"
android:text="Nieuws en Agenda" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="40dp"
android:orientation="horizontal">
<ImageButton
android:id="#+id/button11"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/afspraakbutton"
android:text="Facebook" />
<ImageButton
android:id="#+id/button12"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/afspraakbutton"
android:text="Youtube" />
<ImageButton
android:id="#+id/button13"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/afspraakbutton"
android:text="Twitter" />
<ImageButton
android:id="#+id/button14"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignTop="#+id/button8"
android:layout_marginRight="5dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitCenter"
android:src="#drawable/afspraakbutton"
android:text="LinkedIn" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
You can try just using TextViews in your layout and add the icons to them as compound drawables using:
textView.setCompoundDrawables(null, yourIconDrawable, null, null);
This will put your drawable to the top of the text. To set the size of the drawable call setBounds(...) on it or use setCompoundDrawablesWithIntrinsicBounds(...) on the TextView. You can also set the padding with setCompoundDrawablePadding(int padding).
Can you try this code and check if it works?
<TextView
android:id="#+id/TextView"
android:layout_width="50dp"
android:layout_height="30dp" --> you can change the size that you want
android:layout_below="#+id/imageButton1" --> you can change the size that you want
android:textAlignment="center" />
Try this but this the not The right way to create this type of view the best way to create Using GridView
<LinearLayout
android:weightSum="3"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="113dp">
<LinearLayout
android:layout_weight="1"
android:orientation="vertical"
android:layout_width="100dp"
android:layout_height="100dp">
<ImageButton
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:src="#mipmap/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Title "/>
</LinearLayout>
<LinearLayout
android:layout_weight="1"
android:orientation="vertical"
android:layout_width="100dp"
android:layout_height="100dp">
<ImageButton
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:src="#mipmap/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Title "/>
</LinearLayout>
<LinearLayout
android:layout_weight="1"
android:orientation="vertical"
android:layout_width="100dp"
android:layout_height="100dp">
<ImageButton
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:src="#mipmap/ic_launcher"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Title "/>
</LinearLayout>
</LinearLayout>
There are a lot of ways to achieve that, one of the most common ways is to use FrameLayout, and another common way is by using RelativeLayout which will give you the ability to predefine the views positions according to eachother(i.e which one is above the other), and following is a good example about how to use RelativeLayout to achieve your purpose:
<RelativeLayout
android:id="#+id/RelativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Add Button 1 -->
<Button
android:id="#+id/button1"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_alignParentTop="true"
android:src="#drawable/image1" />
<!-- Add Text 1 -->
<TextView
android:id="#+id/text1"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_below="#id/button1"
android:text="text1" />
</RelativeLayout>
I have an image and some text and below that i have a sliding tab layout with a view pager and the view pager has 3 fragments each having one recycler view each . Now my problem is that i want to scroll the recyclerview and at the same time i want to scroll the rest of the elements too. For eg when i scroll the recycler view i want all other views to scroll as well. This my XML layout
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fillViewport="true"
>
<RelativeLayout
android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/imageView7"
android:src="#drawable/aal"
android:adjustViewBounds="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#98000000"
android:id="#+id/innerColor"
android:layout_alignBottom="#+id/imageView7"
android:layout_alignParentTop="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/include"
android:padding="13dp"
>
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:clickable="true"
android:background="#drawable/custom_bg"
android:onClick="BackPressed"
android:src="#drawable/ic_arrow_back"
android:id="#+id/imageView2" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:clickable="true"
android:src="#drawable/add"
android:id="#+id/addAction"
android:onClick="showImage"
android:background="#drawable/custom_bg"
android:tint="#color/icons"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sample "
android:textSize="22sp"
android:id="#+id/textHeader"
android:textColor="#ffffff"
android:layout_marginLeft="12dp"
android:scaleType="centerCrop"
android:layout_above="#+id/descText"
android:layout_marginBottom="10dp"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:id="#+id/descText"
android:layout_marginLeft="12dp"
android:text="Sampletext"
android:layout_above="#+id/Fbutton"
android:layout_marginBottom="10dp"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="Follow"
android:onClick="followUnfollow"
android:background="#drawable/follow_button_bg"
android:stateListAnimator="#null"
android:textColor="#403e3e"
android:padding="5dp"
android:id="#+id/Fbutton"
android:layout_alignParentBottom="true"
android:layout_marginBottom="150dp"
android:layout_centerHorizontal="true" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Fbutton"
android:layout_marginTop="-80dp"
android:id="#+id/relativeLayout5"
android:layout_centerHorizontal="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/relStatMem"
android:layout_alignTop="#+id/relativeLayout5"
android:layout_toEndOf="#+id/relativeLayout5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numImages"
android:text="500"
android:textColor="#ffffff"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/texts"
android:textSize="12dp"
android:textColor="#ffffff"
android:text="PHOTOS"
android:layout_marginLeft="30dp"
android:layout_below="#+id/numImages"
android:layout_centerHorizontal="true" />
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#ffffff"
android:layout_marginLeft="80dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/relStatFol"
android:layout_alignTop="#+id/relStatMem"
android:layout_toEndOf="#+id/relStatMem">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numMembers"
android:text="5"
android:textColor="#ffffff"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textsMembers"
android:textSize="12dp"
android:textColor="#ffffff"
android:text="MEMBERS"
android:layout_marginLeft="30dp"
android:layout_below="#+id/numMembers"
android:layout_centerHorizontal="true" />
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#ffffff"
android:layout_marginLeft="80dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/relStatFols"
android:layout_alignTop="#+id/relStatFol"
android:layout_toEndOf="#+id/relStatFol">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/numFolls"
android:text="1B"
android:textColor="#ffffff"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textsFol"
android:textSize="12dp"
android:textColor="#ffffff"
android:text="FOLLOWERS"
android:layout_marginLeft="30dp"
android:layout_below="#+id/numFolls"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<!--In addition to the two java files we got from google git , this is what you need for tabs-->
<com.example.skmishra.plates.Library.SlidingTabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_below="#+id/innerColor"
android:layout_height="wrap_content">
<!--For elevation add here-->
</com.example.skmishra.plates.Library.SlidingTabLayout>
<android.support.v4.view.ViewPager android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="#id/tabs"
android:id="#+id/viewPager"
android:fillViewport="false">
</android.support.v4.view.ViewPager>
</RelativeLayout>
</ScrollView>
Google + Does that , i would like to implement something simillar
I believe Google used a Collapsing Toolbar Layout, which will collaps the toolbar on scroll or other events.
You can find more information here.
<android.support.design.widget.AppBarLayout
android:layout_height="192dp"
android:layout_width="match_parent">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
I made a design for my application but it runs really slow. The results that I am trying to achieve is this:
So far I have been able to achieve this result with this xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.asteam.unify.Mbajtje">
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_marginRight="#dimen/general_margin"
android:layout_marginLeft="#dimen/general_margin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/lendaText"
android:layout_marginTop="#dimen/general_margin"
android:text="Lënda:"/>
<Spinner
android:id="#+id/lendaMbajtje"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/lendaText"
android:textSize="#dimen/font_size"
android:background="#drawable/border_bottom"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/subjektiText"
android:layout_marginTop="#dimen/general_margin"
android:layout_below="#id/lendaMbajtje"
android:text="Subjekti:"/>
<Spinner
android:id="#+id/subjektiMbajtje"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/subjektiText"
android:textSize="#dimen/font_size"
android:background="#drawable/border_bottom"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/subjektiMbajtje"
android:id="#+id/detajetMbajtjesText"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginRight="#dimen/general_margin"
android:layout_weight="3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:text="Data e mbajtjes:"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:id="#+id/dates"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:orientation="horizontal">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/dayMbajtje"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:textSize="#dimen/font_size"
android:gravity="center"
android:layout_marginRight="5dp"
android:text="12"
android:paddingBottom="#dimen/padding_spiner"
android:singleLine="true"
android:inputType="number"
android:imeOptions="actionNext"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/monthMbajtje"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:gravity="center"
android:textSize="#dimen/font_size"
android:layout_marginRight="5dp"
android:text="02"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/yearMbajtje"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:gravity="center"
android:textSize="#dimen/font_size"
android:text="2016"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="#dimen/general_margin"
android:layout_weight="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:text="Ora e mbajtjes:"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_marginTop="3dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/hourMbajtje"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:gravity="center"
android:textSize="#dimen/font_size"
android:text="22"
android:paddingBottom="#dimen/padding_spiner"
android:singleLine="true"
android:inputType="number"
android:imeOptions="actionNext"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text=":"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:id="#+id/minutesMbajtje"
android:textSize="#dimen/font_size"
android:gravity="center"
android:text="20"
android:paddingBottom="#dimen/padding_spiner"
android:singleLine="true"
android:inputType="number"
android:imeOptions="actionNext"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_below="#+id/detajetMbajtjesText"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="#dimen/vertical_padding"
android:id="#+id/duttyCount"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:id="#+id/duttyView"
android:layout_alignParentLeft="true"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center_vertical"
android:layout_marginRight="#dimen/margin_spiner"
android:text="Detyra e :"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/duttyCountS"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:gravity="center"
android:text="parë"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_alignParentRight="true"
android:id="#+id/checkboxPresentationLinear"
android:layout_height="wrap_content">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Prezantim"
android:layout_gravity="right"
android:id="#+id/presentationDutty"
android:imeOptions="actionNext"/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/duttyCount"
android:id="#+id/detajetMbajtjesPrezantimText"
android:orientation="horizontal"
android:visibility="gone"
android:showDividers="end">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginRight="#dimen/general_margin"
android:layout_weight="3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:text="Data e prezantimit:"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:id="#+id/datesPresentation"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:orientation="horizontal">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/dayPresentation"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:textSize="#dimen/font_size"
android:gravity="center"
android:layout_marginRight="5dp"
android:text="12"
android:paddingBottom="#dimen/padding_spiner"
android:singleLine="true"
android:inputType="number"
android:imeOptions="actionNext"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/monthPresentation"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:gravity="center"
android:textSize="#dimen/font_size"
android:layout_marginRight="5dp"
android:text="02"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/yearPresentation"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:gravity="center"
android:textSize="#dimen/font_size"
android:text="2016"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="#dimen/general_margin"
android:layout_weight="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:text="Ora e prezantimit:"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_marginTop="3dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/hourPresentation"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:gravity="center"
android:textSize="#dimen/font_size"
android:text="22"
android:paddingBottom="#dimen/padding_spiner"
android:singleLine="true"
android:inputType="number"
android:imeOptions="actionNext"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text=":"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/border_bottom"
android:layout_weight="1"
android:id="#+id/minutesPresentation"
android:textSize="#dimen/font_size"
android:gravity="center"
android:text="20"
android:paddingBottom="#dimen/padding_spiner"
android:singleLine="true"
android:inputType="number"
android:imeOptions="actionNext"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/psText"
android:layout_marginTop="#dimen/general_margin"
android:layout_below="#+id/detajetMbajtjesPrezantimText"
android:text="P.s."/>
<EditText
android:layout_width="match_parent"
android:layout_height="150dp"
android:inputType="textMultiLine"
android:id="#+id/psTextArea"
android:padding="#dimen/padding_spiner"
android:layout_below="#+id/psText"
android:layout_marginTop="#dimen/padding_spiner"
android:textSize="#dimen/font_size"
android:gravity="top"
android:background="#drawable/border_textarea"
android:imeOptions="actionDone"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/previewMbajtje"
android:layout_below="#+id/psTextArea"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</ScrollView>
I was hoping someone could tell me how I can optimize this xml code?
You have a bad layout structure that is bound for performance issues. There are many ways to optimize it, in your case:
The surrounding FrameLayout can be removed, since it just holds a ScrollView. Make the scroll view your root.
Don't use a RelativeLayout this far at the top of your layout. It will require 2 layout passes for every children. Use a LinearLayout since you are just aligning views in a vertical order
You have at least one LinearLayout that just wraps another LinearLayout. You should merge them into one.
You have a LinearLayout with weights inside another LinearLayout with weights. This also requires multiple layout passes.
There is a horizontal LinearLayout within another horizontal LinearLayout. You could probably also merge those.
There are also lots of tutorials on what to do and what not to do.