how to fix Delays in scrolling on my android app - java

in my main page app , When scrolling, delayed !
how to fix it ?!
I've compressed images by Photoshop and The total size of all images is <= 100kb and type of images are jpg and png ...
here is my main_layout.xml codes :
<?xml version="1.0" encoding="utf-8"?><FrameLayout
android:layo`enter code here`ut_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout_main" android:layoutDirection="rtl"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<AbsoluteLayout
android:layout_width="match_parent" android:id="#+id/content_frame"
android:layout_height="match_parent" android:background="#EEEEEE"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent" android:fillViewport="true"
android:id="#+id/mainscrollView" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#null" android:layoutDirection="ltr"
android:orientation="vertical">
<include layout="#layout/find_my_around" />
<include layout="#layout/maxoption_first_page" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#null" >
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_gravity="right"
android:layout_marginRight="5dp" android:tag="persian"
android:text="برترین ها در شهر"
android:gravity="right|center_vertical"
android:textColor="#000000"
android:textSize="19sp" />
<com.balysv.materialripple.MaterialRippleLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ff7584"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400"
app:mrl_rippleFadeDuration="250" android:layout_marginLeft="5dp"
android:layout_marginTop="10dp" android:layout_gravity="left"
android:layout_marginBottom="10dp" >
<Button
android:layout_width="70dp" android:gravity="center|center_vertical"
android:layout_height="30dp" android:tag="persian"
android:text="بیشتر >"
android:id="#+id/morebzpbest"
android:textColor="#000000"
android:background="#ffc518" />
</com.balysv.materialripple.MaterialRippleLayout>
</FrameLayout>
<org.lucasr.twowayview.TwoWayView
android:id="#+id/bestcity"
style="#style/TwoWayView" android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
tools:context=".BazardanApp" />
<include layout="#layout/iamhungrybanner"/>
<LinearLayout
android:layout_width="fill_parent" android:orientation="vertical" android:id="#+id/foodstation"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#null" >
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_gravity="right"
android:layout_marginRight="5dp" android:tag="persian"
android:text="ایستگاه غذا"
android:gravity="right|center_vertical"
android:textColor="#000000"
android:textSize="19sp" />
<com.balysv.materialripple.MaterialRippleLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ff7584" android:id="#+id/ripplemenuop765"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400"
app:mrl_rippleFadeDuration="250" android:layout_marginLeft="5dp"
android:layout_marginTop="10dp" android:layout_gravity="left"
android:layout_marginBottom="10dp" >
<Button
android:layout_width="70dp" android:gravity="center|center_vertical"
android:layout_height="30dp" android:tag="persian"
android:text="بیشتر >"
android:id="#+id/morestationfoods"
android:textColor="#000000"
android:background="#ffc518" />
</com.balysv.materialripple.MaterialRippleLayout>
</FrameLayout>
<org.lucasr.twowayview.TwoWayView
android:id="#+id/bestmenubzps"
style="#style/TwoWayView" android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
tools:context=".BazardanApp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<include layout="#layout/full_screen_loader_by_wifichecker"/>
<include layout="#layout/custom_actionbar"/>
</AbsoluteLayout>
<include layout="#layout/main_menu"/>
</android.support.v4.widget.DrawerLayout>
<include layout="#layout/gettextlayout"/>
<include layout="#layout/signup_notfi"/>
<include layout="#layout/requestfor_signup"/>
<include layout="#layout/requestfor_salecredit"/>
<include layout="#layout/bazardan_id_finder"/>
<include layout="#layout/you_have_gift"/>
here is find_my_around.xml codes :
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:id="#+id/findmyaround"
android:layout_height="270dp"
android:gravity="center|center_vertical">
<com.balysv.materialripple.MaterialRippleLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ffffff"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400"
app:mrl_rippleFadeDuration="250" >
<FrameLayout
android:layout_width="fill_parent" android:layout_centerInParent="true"
android:layout_centerVertical="true" android:layout_centerHorizontal="true"
android:layout_height="fill_parent" android:id="#+id/serachmayaround">
<ImageView
android:layout_width="fill_parent" android:src="#drawable/bgmyaround" android:id="#+id/bgmyaroundimg"
android:layout_height="fill_parent" android:scaleType="centerCrop" />
<ImageView
android:layout_width="fill_parent" android:src="#drawable/bgmyerondshadow" android:layout_gravity="bottom"
android:layout_height="100dp" android:scaleType="fitXY" />
<LinearLayout
android:layout_width="fill_parent" android:orientation="vertical" android:layout_gravity="center|center_vertical"
android:layout_height="fill_parent" android:gravity="center|center_vertical" android:layout_marginTop="10dp">
<ImageButton
android:layout_width="60dp"
android:background="#drawable/roundedbutton60"
android:src="#drawable/mycurentlocation"
android:scaleType="centerInside" android:layout_gravity="center|center_vertical"
android:padding="10dp"
android:layout_height="60dp" />
<TextView
android:layout_width="fill_parent" android:textSize="20sp" android:textColor="#fff"
android:layout_marginTop="10dp" android:text="اطراف خود را کشف کنید !"
android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
android:gravity="center|center_vertical" android:layout_gravity="center|center_vertical"
android:id="#+id/textpersia344" />
</LinearLayout>
</FrameLayout>
</com.balysv.materialripple.MaterialRippleLayout>
here is maxoption_first_page.xml codes :
<?xml version="1.0" encoding="utf-8"?><LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="150dp"
android:gravity="left"
android:baselineAligned="false" >
<com.balysv.materialripple.MaterialRippleLayout
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ffa911"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400" android:layout_gravity="left"
app:mrl_rippleFadeDuration="250" android:layout_weight="0.50"
android:layout_width="0dp" android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent" android:layout_gravity="center|center_vertical"
android:id="#+id/openscanbarcode"
android:layout_height="fill_parent" android:background="#ffffff">
<ImageView
android:layout_width="fill_parent" android:scaleType="centerCrop"
android:layout_height="fill_parent" android:src="#drawable/bgbarcodescanner" />
<ImageView
android:layout_width="fill_parent" android:scaleType="centerInside" android:padding="8dp"
android:layout_height="fill_parent" android:src="#drawable/handgqscanner" android:layout_marginBottom="20dp" />
<TextView
android:layout_width="fill_parent" android:layout_gravity="bottom" android:gravity="center|center_vertical"
android:paddingTop="9dp" android:paddingBottom="10dp" android:paddingLeft="5dp" android:paddingRight="5dp"
android:lineSpacingExtra="8dp"
android:layout_height="wrap_content" android:background="#88000000" android:tag="persian" android:textSize="15sp"
android:textColor="#ffffff" android:text="اسکن برچسب بازاردان" />
</FrameLayout>
</com.balysv.materialripple.MaterialRippleLayout>
<com.balysv.materialripple.MaterialRippleLayout
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ffa911"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400"
app:mrl_rippleFadeDuration="250" android:layout_gravity="left" android:layout_weight="0.50"
android:layout_width="0dp" android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent" android:layout_gravity="center|center_vertical"
android:id="#+id/openidbzpfinder"
android:layout_height="fill_parent" android:background="#ffffff">
<ImageView
android:layout_width="fill_parent" android:scaleType="centerCrop"
android:layout_height="fill_parent" android:src="#drawable/bgidfinder" />
<ImageView
android:layout_width="fill_parent" android:scaleType="centerInside" android:padding="8dp"
android:layout_height="fill_parent" android:src="#drawable/atbzp" android:layout_marginBottom="20dp" />
<TextView
android:layout_width="fill_parent" android:layout_gravity="bottom" android:gravity="center|center_vertical"
android:paddingTop="9dp" android:paddingBottom="10dp" android:paddingLeft="5dp" android:paddingRight="5dp"
android:lineSpacingExtra="8dp"
android:layout_height="wrap_content" android:background="#88000000" android:tag="persian" android:textSize="15sp"
android:textColor="#ffffff" android:text="شناسه یاب بازاردان" />
</FrameLayout>
</com.balysv.materialripple.MaterialRippleLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="150dp"
android:gravity="left"
android:baselineAligned="false" >
<com.balysv.materialripple.MaterialRippleLayout
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ffa911"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400" android:layout_gravity="left"
app:mrl_rippleFadeDuration="250" android:layout_weight="0.50"
android:layout_width="0dp" android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent" android:layout_gravity="center|center_vertical"
android:id="#+id/openmaybeknow"
android:layout_height="fill_parent" android:background="#ffffff">
<ImageView
android:layout_width="fill_parent" android:scaleType="centerCrop"
android:layout_height="fill_parent" android:src="#drawable/bgidfinder" />
<ImageView
android:layout_width="fill_parent" android:scaleType="centerInside" android:padding="8dp"
android:layout_height="fill_parent" android:src="#drawable/meybeknow" android:layout_marginBottom="20dp" />
<TextView
android:layout_width="fill_parent" android:layout_gravity="bottom" android:gravity="center|center_vertical"
android:paddingTop="9dp" android:paddingBottom="10dp" android:paddingLeft="5dp" android:paddingRight="5dp"
android:lineSpacingExtra="8dp"
android:layout_height="wrap_content" android:background="#88000000" android:tag="persian" android:textSize="15sp"
android:textColor="#ffffff" android:text="شاید بشناسید !" />
</FrameLayout>
</com.balysv.materialripple.MaterialRippleLayout>
<com.balysv.materialripple.MaterialRippleLayout
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ffa911"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400"
app:mrl_rippleFadeDuration="250" android:layout_gravity="left" android:layout_weight="0.50"
android:layout_width="0dp" android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent" android:layout_gravity="center|center_vertical"
android:id="#+id/openmyfinger5km"
android:layout_height="fill_parent" android:background="#ffffff">
<ImageView
android:layout_width="fill_parent" android:scaleType="centerCrop"
android:layout_height="fill_parent" android:src="#drawable/bgbarcodescanner" />
<ImageView
android:layout_width="fill_parent" android:scaleType="centerInside" android:padding="8dp"
android:layout_height="fill_parent" android:src="#drawable/locationf3" android:layout_marginBottom="20dp" />
<TextView
android:layout_width="fill_parent" android:layout_gravity="bottom" android:gravity="center|center_vertical"
android:paddingTop="9dp" android:paddingBottom="10dp" android:paddingLeft="5dp" android:paddingRight="5dp"
android:lineSpacingExtra="8dp"
android:layout_height="wrap_content" android:background="#88000000" android:tag="persian" android:textSize="15sp"
android:textColor="#ffffff" android:text="۵ کیلومتری انگشتتان !" />
</FrameLayout>
</com.balysv.materialripple.MaterialRippleLayout>
</LinearLayout>
<com.balysv.materialripple.MaterialRippleLayout
android:layout_width="fill_parent" android:layout_height="wrap_content"
app:mrl_rippleOverlay="true"
app:mrl_rippleColor="#ffffff"
app:mrl_rippleAlpha="0.3"
app:mrl_rippleDelayClick="false"
app:mrl_rippleHover="true"
app:mrl_rippleDuration="400"
app:mrl_rippleFadeDuration="250" >
<FrameLayout
android:layout_width="fill_parent" android:id="#+id/amionbzardan"
android:layout_height="200dp">
<ImageView
android:layout_width="fill_parent" android:scaleType="centerCrop"
android:layout_height="fill_parent" android:src="#drawable/bgredcrystal" />
<ImageView
android:layout_width="fill_parent" android:src="#drawable/bgmyerondshadowtop" android:layout_gravity="top"
android:layout_height="100dp" android:scaleType="fitXY" />
<ImageView
android:layout_width="fill_parent" android:src="#drawable/bgmyerondshadow" android:layout_gravity="bottom"
android:layout_height="100dp" android:scaleType="fitXY" />
<LinearLayout
android:layout_width="fill_parent" android:orientation="vertical" android:layout_gravity="center|center_vertical"
android:layout_height="fill_parent" android:gravity="center|center_vertical" >
<ImageButton
android:layout_width="60dp"
android:background="#drawable/roundedbutton60"
android:src="#drawable/mycurentlocation"
android:scaleType="centerInside" android:layout_gravity="center|center_vertical"
android:padding="10dp"
android:layout_height="60dp" />
<TextView
android:layout_width="fill_parent" android:textSize="20sp" android:textColor="#fff"
android:layout_marginTop="10dp" android:text="آیا هم اکنون در محل بازاردانی هستید ؟!"
android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"
android:gravity="center|center_vertical" android:layout_gravity="center|center_vertical" android:tag="persian" />
</LinearLayout>
</FrameLayout>
</com.balysv.materialripple.MaterialRippleLayout>
please help me , how to fix it ?!

It looks like that your are displaying Bitmaps in your adapter directly by using imageView.setImageBitmap. Instead you should use UniversalImageLoader. In ListViews bitmaps should not be displayed on Main thread instead should be loaded on background threads see the link https://github.com/nostra13/Android-Universal-Image-Loader

Related

remove space or change color between the views in android

As shown in the picture below there is a gap between buttons and text views. i need to remove this space or i need to change its color to primary color. here is my code and snap
enter image description here
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="5">
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="2"
android:orientation="vertical"
android:background="#color/colorPrimary"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:layout_height="170dp">
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/logo1"
android:layout_width="fill_parent"
android:layout_height="100sp"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="2dp"
android:background="#color/colorPrimary">
<LinearLayout
android:id="#+id/mobileRelView"
android:orientation="vertical"
android:weightSum="2"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="1dp"
android:onClick="goToMobileForm"
android:layout_weight="0.25">
<ImageView
android:padding="7dp"
android:id="#+id/mobile_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="1dp"
android:clickable="false"
android:layout_weight="0.7"
android:scaleType="fitCenter"
android:src="#drawable/smartphone"/>
<Button
android:id="#+id/mobile_button"
android:layout_width="match_parent"
android:layout_weight="1.3"
android:clickable="false"
android:layout_height="match_parent"
android:background="#color/colorPrimary"
android:text="Mobile"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="#dimen/mainbuttontext"/>
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:onClick="goToDesktopForm"
android:weightSum="2"
android:clickable="true"
android:paddingLeft="2dp"
android:paddingRight="1dp"
android:layout_weight="0.25">
<ImageView
android:id="#+id/desktop_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:clickable="false"
android:scaleType="fitCenter"
android:src="#drawable/compuericon"/>
<Button
android:text="Desktop"
android:textAllCaps="false"
android:layout_width="match_parent"
android:clickable="false"
android:layout_height="match_parent"
android:id="#+id/desktop_button"
android:background="#color/colorPrimary"
android:textSize="#dimen/mainbuttontext"
android:textColor="#000000"
android:layout_weight="1.3" />
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:layout_width="match_parent"
android:paddingLeft="1dp"
android:orientation="vertical"
android:onClick="goToLaptopForm"
android:weightSum="2"
android:layout_height="match_parent"
android:layout_weight="0.25">
<ImageView
android:id="#+id/laptop_Image"
android:layout_width="match_parent"
android:layout_weight="0.7"
android:clickable="false"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="#drawable/laptop" />
<Button
android:text="Laptop"
android:textAllCaps="false"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/laptop_button"
android:textSize="#dimen/mainbuttontext"
android:background="#color/colorPrimary"
android:textColorHint="#ffffff"
android:layout_weight="1.3"
android:textColor="#000000"/>
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/logobutton1"
android:layout_width="fill_parent"
android:layout_height="100sp"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="2dp"
android:background="#color/colorPrimary">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="2dp"
android:paddingLeft="1dp"
android:onClick="gotToOthersForm"
android:weightSum="2"
android:layout_weight="0.25">
<ImageView
android:id="#+id/homeappliances_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:padding="7dp"
android:clickable="false"
android:scaleType="fitCenter"
android:src="#drawable/washingmachine"/>
<Button
android:text="Home Appliance"
android:textAllCaps="false"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/homeappliances_button"
android:background="#color/colorPrimary"
android:textSize="#dimen/mainbuttontext"
android:layout_weight="1.3"
android:textColor="#000000"/>
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="1dp"
android:weightSum="2"
android:onClick="goToDesktopForm"
android:layout_weight="0.25">
<ImageView
android:layout_weight="0.7"
android:clickable="false"
android:id="#+id/cleaning_Image"
android:padding="7dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="#drawable/caricon" />
<Button
android:text="Automobile"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/cleaning_button"
android:background="#color/colorPrimary"
android:textSize="#dimen/mainbuttontext"
android:layout_weight="1.3"
android:clickable="false"
android:textColor="#000000" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:orientation="vertical"
android:weightSum="2"
android:onClick="gotToOthersForm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="1dp"
android:layout_weight="0.25">
<ImageView
android:layout_weight="0.7"
android:id="#+id/othrs_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:padding="7dp"
android:clickable="false"
android:src="#drawable/othersicon" />
<Button
android:text="Others"
android:textAllCaps="false"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/others_button"
android:background="#color/colorPrimary"
android:textSize="#dimen/mainbuttontext"
android:layout_weight="1.3"
android:textColor="#000000"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="150sp">
<!--<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#6A1B9A"
android:textStyle="bold"
android:background="#ffb300"
android:textSize="15sp"
android:text="Why eFix ?" />
-->
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="2dp"
android:scaleType="centerCrop"
app:srcCompat="#drawable/abca" />
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
This is happening due to use of Button. Use TextView instead of Button.
#. I have modified your XML and removed some redundant attributes and updated ImageView and TextView with proper weight and height.
#. I have added attribute android:background="?attr/selectableItemBackground" to LinearLayout to show ripple effect when click on it.
Here is the working code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="5">
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="2"
android:orientation="vertical"
android:background="#color/colorPrimary"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:layout_height="170dp">
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout
android:id="#+id/logo1"
android:layout_width="fill_parent"
android:layout_height="100sp"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="2dp"
android:background="#color/colorPrimary">
<LinearLayout
android:id="#+id/mobileRelView"
android:orientation="vertical"
android:weightSum="2"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="1dp"
android:onClick="goToMobileForm"
android:layout_weight="0.25"
android:background="?attr/selectableItemBackground">
<ImageView
android:padding="7dp"
android:id="#+id/mobile_Image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:elevation="1dp"
android:clickable="false"
android:layout_weight="1.3"
android:scaleType="fitCenter"
android:src="#mipmap/ic_launcher"/>
<TextView
android:id="#+id/mobile_button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center"
android:clickable="false"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="#dimen/mainbuttontext"
android:text="Mobile" />
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:onClick="goToDesktopForm"
android:weightSum="2"
android:clickable="true"
android:paddingLeft="2dp"
android:paddingRight="1dp"
android:layout_weight="0.25"
android:background="?attr/selectableItemBackground">
<ImageView
android:padding="7dp"
android:id="#+id/desktop_Image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3"
android:clickable="false"
android:scaleType="fitCenter"
android:src="#mipmap/ic_launcher"/>
<TextView
android:id="#+id/desktop_button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center"
android:clickable="false"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="#dimen/mainbuttontext"
android:text="Desktop" />
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:layout_width="match_parent"
android:paddingLeft="1dp"
android:orientation="vertical"
android:onClick="goToLaptopForm"
android:weightSum="2"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:background="?attr/selectableItemBackground">
<ImageView
android:padding="7dp"
android:id="#+id/laptop_Image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3"
android:clickable="false"
android:scaleType="fitCenter"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/laptop_button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center"
android:clickable="false"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="#dimen/mainbuttontext"
android:text="Laptop" />
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/logobutton1"
android:layout_width="fill_parent"
android:layout_height="100sp"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="2dp"
android:background="#color/colorPrimary">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="2dp"
android:paddingLeft="1dp"
android:onClick="gotToOthersForm"
android:weightSum="2"
android:layout_weight="0.25"
android:background="?attr/selectableItemBackground">
<ImageView
android:id="#+id/homeappliances_Image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3"
android:padding="7dp"
android:clickable="false"
android:scaleType="fitCenter"
android:src="#mipmap/ic_launcher"/>
<TextView
android:id="#+id/homeappliances_button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center"
android:clickable="false"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="#dimen/mainbuttontext"
android:text="Home Appliance" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="1dp"
android:weightSum="2"
android:onClick="goToDesktopForm"
android:layout_weight="0.25"
android:background="?attr/selectableItemBackground">
<ImageView
android:id="#+id/cleaning_Image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3"
android:clickable="false"
android:scaleType="fitCenter"
android:src="#mipmap/ic_launcher"
android:padding="7dp" />
<TextView
android:id="#+id/cleaning_button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center"
android:clickable="false"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="#dimen/mainbuttontext"
android:text="Automobile" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:orientation="vertical"
android:weightSum="2"
android:onClick="gotToOthersForm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="1dp"
android:layout_weight="0.25"
android:background="?attr/selectableItemBackground">
<ImageView
android:id="#+id/othrs_Image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3"
android:scaleType="fitCenter"
android:clickable="false"
android:src="#mipmap/ic_launcher"
android:padding="7dp" />
<TextView
android:id="#+id/others_button"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center"
android:clickable="false"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="#dimen/mainbuttontext"
android:text="Others"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="150sp">
<!--<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#6A1B9A"
android:textStyle="bold"
android:background="#ffb300"
android:textSize="15sp"
android:text="Why eFix ?" />
-->
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="2dp"
android:scaleType="centerCrop"
android:src="#mipmap/ic_launcher" />
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
OUTPUT:

how to make cardview a parent layout with scrollable content

i am working on some application but want to make card view widget a parent layout, problem is my content is not vertically scrollable inside the cardview widget,how can i solve it,thank you.
here is my code;
tools:context="com.example.hacker.guidekyu.Home">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25dp"
android:text=" WELCOME TO KYU"
/>
<ViewFlipper
android:id="#+id/bckgrndViewFlipper1"
android:layout_width="fill_parent"
android:layout_height="200dp">
<ImageView
android:id="#+id/bckgrndImageView8"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="#mipmap/one" />
<ImageView
android:id="#+id/bckgrndImageView7"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="#mipmap/two" />
<ImageView
android:id="#+id/bckgrndImageView6"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="#mipmap/three" />
<ImageView
android:id="#+id/bckgrndImageView5"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="#mipmap/two" />
<ImageView
android:id="#+id/bckgrndImageView4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="#mipmap/one" />
</ViewFlipper>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff0"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:background="#58a3c1"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_weight="50"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
<LinearLayout
android:layout_weight="50"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff0"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:background="#58a3c1"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_weight="50"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
<LinearLayout
android:layout_weight="50"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff0"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:background="#58a3c1"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_weight="50"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
<LinearLayout
android:layout_weight="50"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ff"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff0"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:background="#58a3c1"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_weight="50"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
<LinearLayout
android:layout_weight="50"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff0"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:background="#58a3c1"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_weight="50"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
<LinearLayout
android:layout_weight="50"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_marginLeft="20dp"
android:gravity="center"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher"
/>
<TextView
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Administration"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
put everything inside the cardview inside a scrollview.
That should allow scrolling.
Change the cardview parameters from wrap_content to something fixed-> smaller in size than the inner content to see scroll happening

Why is my DrawableLeft doesn't appear the same on different device?

I dont know why Galaxy S6 doesn't recognize my .xml page
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="#drawable/arrowindidown"
android:width="10dp"
android:height="10dp"
/>
</layer-list>
Normally it will resize the image (the arrow) into 10dp as it appears in my Galaxy S6 edge+
(First screenshot is from my Samsung Galaxy S6 edge+)
(My homepage layout)
<!-- non-scrolling top pane -->
<LinearLayout
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10">
<ImageView
android:id="#+id/logo_home_id"
android:clickable="true"
android:onClick="onButtonClick"
android:layout_width="150dp"
android:layout_height="45dp"
android:background="#drawable/logo"/>
</LinearLayout>
<ViewFlipper
android:id="#+id/viewFlipper"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="35">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/picture3"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/picture"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/picture2"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/picture4"/>
<ImageView
android:id="#+id/image5"
android:clickable="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/picture5"
android:onClick="onButtonClick" />
</ViewFlipper>
<ViewFlipper
android:id="#+id/viewFlipperText"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="7">
<TextView
android:background="#drawable/border3"
android:textStyle="italic"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#ffffff"
android:text="Programme" />
<TextView
android:background="#404040"
android:textStyle="italic"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#ffffff"
android:text="FIFOG classics" />
<TextView
android:background="#404040"
android:textStyle="italic"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#ffffff"
android:text="Palmares" />
<TextView
android:background="#404040"
android:textStyle="italic"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#ffffff"
android:text="Cairo time de Amir Ramses" />
<TextView
android:background="#404040"
android:textStyle="italic"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#ffffff"
android:text="Ahlam Mosteghanemi Présidente d'honneur du FIFOG 2016" />
</ViewFlipper>
<LinearLayout
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:orientation="horizontal"
>
<Button
android:background="#drawable/arrowotherside"
android:id="#+id/button1"
android:layout_weight="1"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:text=""
android:onClick="onButtonClick" />
<LinearLayout
android:layout_gravity="center"
android:layout_weight="50"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ViewFlipper
android:id="#+id/viewFlipperDot"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_gravity="center"
android:layout_width="70dp"
android:layout_height="7dp"
android:background="#drawable/c1"/>
<ImageView
android:layout_gravity="center"
android:layout_width="70dp"
android:layout_height="7dp"
android:background="#drawable/circle2"/>
<ImageView
android:layout_gravity="center"
android:layout_width="70dp"
android:layout_height="7dp"
android:background="#drawable/circle3"/>
<ImageView
android:layout_gravity="center"
android:layout_width="70dp"
android:layout_height="7dp"
android:background="#drawable/circle4"/>
<ImageView
android:layout_gravity="center"
android:layout_width="70dp"
android:layout_height="7dp"
android:background="#drawable/circle5"/>
</ViewFlipper>
</LinearLayout>
<Button
android:background="#drawable/arrowside"
android:id="#+id/button3"
android:layout_weight="1"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="fill_vertical"
android:text=""
android:onClick="onButtonClick" />
</LinearLayout>
<!-- scrolling bottom pane -->
<ScrollView
android:fillViewport="true"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="33">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/expandableListView" />
</LinearLayout>
</ScrollView>
<TextView
android:textColor="#ffffff"
android:textSize="10sp"
android:gravity="center|bottom"
android:text="© FIFOG Mobile Application"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
</LinearLayout>
(My Group Layout - for my Expandablelistview)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:drawableLeft="#drawable/group_indicator_selector"
android:gravity="center"
android:background="#drawable/border"
android:id="#+id/parent_txt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#ffffff"
android:paddingTop="15dp"
android:paddingBottom="15dp"/>
</LinearLayout>
Please help.

Java Android - situate the ListView under all other

i has a layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="#+id/lineradapter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:layout_marginTop="4dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp">
<FrameLayout
android:id="#+id/frameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="6dp">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:textColor="#525252"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:text="00:00"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="italic" />
</FrameLayout>
<TextView
android:id="#+id/desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingBottom="6dip"
android:textColor="#acacac"
android:textSize="16dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#e7e7e7"
android:paddingTop="6dp"
android:paddingBottom="4dp" />
</LinearLayout>
</RelativeLayout>
in this layout i want to position the ListView. At the end, so that you can first see what the top, and then scroll down to see ListView. How to do it? I probyval added before /RelativeLayout>
<LinearLayout
android:id="#+id/comentadapter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:layout_gravity="top|center"/>
<ListView
android:id="#+id/commentList"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
But it is still located at the top.
Use this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="#+id/lineradapter"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:layout_weight=".3"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<FrameLayout
android:id="#+id/frameLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp" >
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:textColor="#525252"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:text="00:00"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="italic" />
</FrameLayout>
<TextView
android:id="#+id/desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingBottom="6dip"
android:textColor="#acacac"
android:textSize="16dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#e7e7e7"
android:paddingBottom="4dp"
android:paddingTop="6dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/comentadapter"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:paddingTop="4dp" />
<ListView
android:id="#+id/commentList"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
</LinearLayout>
Best way to show the listview scrollable with the whole layout you will have to create two layout
for top.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="#+id/lineradapter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:textColor="#525252"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:text="00:00"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="italic" />
<TextView
android:id="#+id/desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingBottom="6dip"
android:textColor="#acacac"
android:textSize="16dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#e7e7e7"
android:paddingBottom="4dp"
android:paddingTop="6dp" />
</LinearLayout>
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:paddingTop="4dp" />
</RelativeLayout>
and create another layout for listview list.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<ListView
android:id="#+id/commentList"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
and setcontentview as list.xml and inflate top.xml and add to listview as Header like
ListView list =(ListView)findViewById(R.id.commentList);
LayoutInflater inflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View headerView =inflater.inflate(R.layout.top.xml, null);
list.addHeaderView(headerView);

Android ViewPager control doesn't appear in Graphical Layout Editor

I would like to use the ViewPager control. I have imported the v4 support package into my build path so there are no issues there.
When I insert this into my layout XML it doesn't appear in the Graphical Layout Editor:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" android:background="#FFFFFF">
<RelativeLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="0"
android:background="#000000" >
<ImageView
android:id="#+id/batteryImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:src="#drawable/battery" />
<ImageView
android:id="#+id/exit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/exit_button" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/batteryImageView"
android:text="76%" />
</RelativeLayout>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/score"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:padding="3dp" >
<View
android:id="#+id/dynamic_background_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/topHorizontalLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/prominentDisplayLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/scoreLabelTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Blast Factor"
android:textSize="30dp" />
<TextView
android:id="#+id/scoreTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:gravity="top|center_horizontal"
android:text="100"
android:textSize="125dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/prominentVerticalLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:layout_weight="2"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/averageLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/averageLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#55000000"
android:gravity="center"
android:text="Average"
android:textSize="13dp" />
<TextView
android:id="#+id/averageScore"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="100"
android:textSize="50dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/lastLinearLayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/lastLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#55000000"
android:gravity="center"
android:text="Last"
android:textSize="13dp" />
<TextView
android:id="#+id/lastScore"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="100"
android:textSize="50dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/demotedDisplayLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<FrameLayout
android:id="#+id/leftPanelFrame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp" >
<LinearLayout
style="#style/MotionMetrics.ScorePanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55000000" >
<ImageView
android:id="#+id/leftPanelImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/swingspeed" />
<TextView
android:id="#+id/leftPanelLabelTextView"
style="#style/MotionMetrics.ScoreHeader"
android:text="Swing Speed" />
<TextView
android:id="#+id/leftPanelTextView"
style="#style/MotionMetrics.ScoreValue"
android:layout_width="match_parent"
android:text="92" />
</LinearLayout>
<ImageView
android:id="#+id/leftPanelSelectionArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/select_arrow" />
</FrameLayout>
<FrameLayout
android:id="#+id/middlePanelFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#55000000" >
<LinearLayout
style="#style/MotionMetrics.ScorePanel"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/middlePanelImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ballspeed" />
<TextView
android:id="#+id/middlePanelLabelTextView"
style="#style/MotionMetrics.ScoreHeader"
android:text="Ball Speed" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="#+id/middlePanelTextView"
style="#style/MotionMetrics.ScoreValue"
android:text="1.3" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="#drawable/score_border" />
<ImageView
android:id="#+id/middlePanelSelectionArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/select_arrow" />
</FrameLayout>
<FrameLayout
android:id="#+id/rightPanelFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#55000000" >
<ImageView
android:id="#+id/rightPanelSelectionArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/select_arrow" />
<LinearLayout
style="#style/MotionMetrics.ScorePanel"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/rightPanelImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/distance" />
<TextView
android:id="#+id/rightPanelLabelTextView"
style="#style/MotionMetrics.ScoreHeader"
android:text="Distance" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="#+id/rightPanelTextView"
style="#style/MotionMetrics.ScoreValue"
android:text="7.6" />
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/view1"
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="#drawable/score_border" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
<android.support.v4.view.ViewPager
android:id="#+android:id/viewpager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<LinearLayout
android:id="#+id/buttonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Button
android:id="#+id/blastButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="Blast" android:layout_weight="1"/>
<Button
android:id="#+id/angleButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="Angle" android:layout_weight="1"/>
<Button
android:id="#+id/timingButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="Timing" android:layout_weight="1"/>
</LinearLayout>
<ImageView
android:id="#+id/tabBarImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/tabbar"/>
</LinearLayout>
I'm not sure why, and I also don't see the UI component in my Palette.
The ViewPager needs to be populated using pagerAdapter in order for it show up on the screen.

Categories