Running android app on the mobile phone and on the emulator - android

I wrote an android application on ICS and set its minimum SDK to 8. I run the app on emulator and it worked correctly but when I install the .apk file on my mobile I got a force close. Why do I get this problem? The app is for OCR.
<?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="fill_parent"
android:background="#android:color/white"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/H1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/iv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:id="#+id/H2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/iv8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/iv10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:id="#+id/H3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
Also I always get this notification in XML file:
[Accessibility] Missing contentDescription attribute on image
Why?

Not sure why it is crashing, but the error you are getting is only a warning. The contentDescription is just for accessibility and not needed. The error that is causing the crash most likely exists elsewhere in your code.

Related

Android design for all screen size and resolution

Hi I am working on an app which has this design. By using a lot of effort i developed this. But this is still not the same as given design and on other screens I got this. This is the code in xml file. Any help willbe greatly appreciated.
<?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="fill_parent"
android:background="#mipmap/dashboard_bg"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#null"
android:src="#mipmap/logo" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#null"
android:src="#mipmap/logo" />
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Welcome text of app" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:contentDescription="#null"
android:src="#mipmap/seperator" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_above="#+id/imageView1"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:contentDescription="#null"
android:src="#mipmap/regional_managers" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView3"
android:layout_toEndOf="#+id/imageView1"
android:layout_toRightOf="#+id/imageView1"
android:contentDescription="#null"
android:src="#mipmap/regions" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/imageView3"
android:layout_alignEnd="#+id/imageView3"
android:layout_below="#+id/imageView4"
android:contentDescription="#null"
android:src="#mipmap/graphs" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_alignTop="#+id/imageView1"
android:layout_toLeftOf="#+id/imageView1"
android:layout_toStartOf="#+id/imageView1"
android:contentDescription="#null"
android:src="#mipmap/nationwide" />
</RelativeLayout>
</LinearLayout>
Also tried links from so like
image size (drawable-hdpi/ldpi/mdpi/xhdpi)
and Setting drawable folder to use for different resolutions but unable to get desired results. Any help willbe greatly appreciated.
Try something like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
app:layout_marginTopPercent="10%"
app:layout_widthPercent="30%" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_marginLeftPercent="20%"
app:layout_marginTopPercent="40%"
app:layout_widthPercent="20%" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_marginLeftPercent="60%"
app:layout_marginTopPercent="55%"
app:layout_widthPercent="20%" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_marginLeftPercent="30%"
app:layout_marginTopPercent="70%"
app:layout_widthPercent="20%" />
</android.support.percent.PercentRelativeLayout>

Android - "Exception raised during rendering: Could not initialize class libcore.util.ZoneInfoDB" on preview and design view

I get this render problem when trying to view the preview or design view in some of my my xml layouts:
Exception raised during rendering: Could not initialize class libcore.util.ZoneInfoDB
Here is one of my layouts with the problem:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/rlMeasures"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp" >
<TextView
android:id="#+id/tvBat"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/percentage"
android:textSize="20sp" />
<TextView
android:id="#+id/tvAlarm"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/tvBat"
android:layout_toRightOf="#id/tvBat"
android:layout_toEndOf="#id/tvBat"
android:gravity="end"
android:text="#string/blank"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/rlMeasures"
android:layout_centerHorizontal="true" >
<TextView
android:id="#+id/tvTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/time"
android:textSize="80sp" />
<TextView
android:id="#+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/tvTime"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="#string/date"
android:textSize="20sp" />
<TextView
android:id="#+id/tvAmPm"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/tvTime"
android:layout_marginBottom="15dp"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#id/tvTime"
android:layout_toEndOf="#id/tvTime"
android:gravity="center"
android:text="#string/ampm"
android:textSize="20sp" />
</RelativeLayout>
<AnalogClock
android:id="#+id/ac"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/rlTime"
android:layout_below="#+id/adView"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:dial="#drawable/acnbface"
android:hand_hour="#drawable/achour"
android:hand_minute="#drawable/acminute" />
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-6205053969368684/3258044850"
android:gravity="center" >
</com.google.android.gms.ads.AdView>
<RelativeLayout
android:id="#+id/rlActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:background="#drawable/gradientright"
android:gravity="center_vertical|start" >
<ScrollView
android:id="#+id/svActivity"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
tools:ignore="UselessParent" >
<RelativeLayout
android:id="#+id/rlActivity2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" >
<ImageButton
android:id="#+id/ibStopwatch"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_margin="10dp"
android:background="#drawable/stopwatch"
android:contentDescription="#string/stopwatch" />
<ImageButton
android:id="#+id/ibFs"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_below="#id/ibStopwatch"
android:layout_margin="10dp"
android:background="#drawable/fs"
android:contentDescription="#string/fs" />
<ImageButton
android:id="#+id/ibFsn"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_below="#id/ibFs"
android:layout_margin="10dp"
android:background="#drawable/fsnm"
android:contentDescription="#string/fsn" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlShort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_gravity="center_vertical"
android:background="#drawable/gradientleft"
android:gravity="center_vertical|end" >
<ScrollView
android:id="#+id/svShort"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
tools:ignore="UselessParent" >
<RelativeLayout
android:id="#+id/rlShort2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" >
<ImageButton
android:id="#+id/ibMusic"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="5dp"
android:background="#drawable/music"
android:contentDescription="#string/music" />
<ImageButton
android:id="#+id/ibYoutube"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibMusic"
android:layout_margin="5dp"
android:background="#drawable/youtube"
android:contentDescription="#string/youtube" />
<ImageButton
android:id="#+id/ibKeep"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibYoutube"
android:layout_margin="5dp"
android:background="#drawable/keep"
android:contentDescription="#string/keep" />
<ImageButton
android:id="#+id/ibPlay"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibKeep"
android:layout_margin="5dp"
android:background="#drawable/play"
android:contentDescription="#string/play" />
<ImageButton
android:id="#+id/ibSearch"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibPlay"
android:layout_margin="5dp"
android:background="#drawable/search"
android:contentDescription="#string/search" />
<ImageButton
android:id="#+id/ibBrowser"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_below="#id/ibSearch"
android:layout_margin="5dp"
android:background="#drawable/browser"
android:contentDescription="#string/browser" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
I am getting no errors or warnings from Android Studio and i can debug the application without any issues. Can anyone explain to me the situation? is it something in my code or an Android Studio Bug?
Thanks
This error occurs with the AnalogClock under Android 21. You can try switching (temporarily) to Android L or lower while you work on your layout.
A report was filed for this issue at http://b.android.com/79160

parallaxscroll view in android is not working

Hi I am trying to achieve parallaxscrollview in my application using library from link below:-
https://github.com/nirhart/ParallaxScroll
And below is the my xml code:-
<com.nirhart.parallaxscroll.views.ParallaxScrollView 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:layout_width="match_parent"
android:layout_height="match_parent"
app:inner_parallax_factor="1.9"
app:parallax_factor="1.9"
app:parallax_views_num="3"
android:background="#drawable/bg_profile_summary" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/LIN_First"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"
android:weightSum="2" >
<RelativeLayout
android:id="#+id/REL_People"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="1"
android:background="#drawable/bg_profile_list_item"
android:padding="10dp" >
<TextView
android:id="#+id/TXT_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:text="#string/str_txt_people"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/IMG_Right_Arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_nav_right_white" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/REL_Popular"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="1"
android:background="#drawable/bg_profile_list_item"
android:padding="10dp" >
<TextView
android:id="#+id/TXT_TitlePopular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:text="#string/str_txt_popular"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/IMG_Right_Arrow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_nav_right_white" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/REL_Official_Act"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/LIN_First"
android:background="#drawable/bg_profile_list_item"
android:padding="10dp" >
<TextView
android:id="#+id/TXT_OfficialAccounts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textStyle="bold"
android:text="#string/str_official_accounts"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/IMG_Right_Arrow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:contentDescription="#string/app_name"
android:src="#drawable/ic_nav_right_white" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/REL_Search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/REL_Official_Act"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<EditText
android:id="#+id/EDT_Search_text"
android:layout_width="250dp"
android:layout_height="35dp"
android:background="#drawable/ic_search_text_background"
android:hint="#string/str_edt_searchanything_hint"
android:paddingBottom="2dp"
android:paddingLeft="15dp"
android:paddingTop="2dp" />
<RelativeLayout
android:id="#+id/REL_SearchButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/EDT_Search_text"
android:background="#drawable/ic_search_btn_bg"
android:gravity="center" >
<Button
android:id="#+id/BTN_Search"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerVertical="true"
android:background="#drawable/ic_search"
android:padding="5dp" />
</RelativeLayout>
</RelativeLayout>
<ListView
android:id="#+id/LST_AlbumList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_alignParentBottom="true"
android:layout_below="#+id/REL_Search"
android:dividerHeight="0dip" >
</ListView>
</RelativeLayout>
</com.nirhart.parallaxscroll.views.ParallaxScrollView>
I am trying to achieve MultipleParallaxScrollView.
But nothing is happening.
Will anybody please explain me what to do??
Thanks in advance.
You need to use LinearLayout as a child in ParallaxScrollView.
You should place one child in ParallaxScrollView containing the entire contents to scroll; which is a LinearLayout
this problem is occurred because dependency use implementation 'com.github.nirhart:parallaxscroll:1.0' not working with compileSdkVersion 27 or new sdk version,
you can salve this to download module from github and impot module in your project and update with ur project sdk version.this is my project update library gradle sdk version

How to prevent imageview overlapping in android

i wanna put multiple imageview in a row like this
http://imgur.com/wYpAgxE
but there is some bugs, the imageview are overlap on top of each other, i want to place them side by side with each other
http://imgur.com/WUHbzCd
Below is my XML file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/background"
android:clipChildren="false"
android:clipToPadding="false"
tools:context=".MainActivity" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="182dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:scaleType="centerCrop"
android:src="#drawable/music_720p" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/imageView1"
android:layout_toEndOf="#+id/imageView1"
android:layout_marginTop="182dp"
android:layout_marginRight="70dp"
android:layout_marginEnd="70dp"
android:scaleType="centerCrop"
android:src="#drawable/video_720p" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/imageView2"
android:layout_toEndOf="#+id/imageView2"
android:layout_marginTop="182dp"
android:layout_marginRight="70dp"
android:layout_marginEnd="70dp"
android:scaleType="centerCrop"
android:src="#drawable/photo_720p" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/imageView3"
android:layout_toEndOf="#+id/imageView3"
android:layout_marginTop="182dp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:scaleType="centerCrop"
android:src="#drawable/web_720p" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/imageView4"
android:layout_toEndOf="#+id/imageView4"
android:layout_marginTop="182dp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:scaleType="centerCrop"
android:src="#drawable/setting_720p" />
</RelativeLayout>
Any help is appreciated.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:clipChildren="false"
android:clipToPadding="false"
tools:context=".MainActivity" >
<HorizontalScrollView
android:id="#+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="false"
android:scrollbars="none" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/setupImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/uploadImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/visulizationImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/setupImageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/uploadImageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:src="#drawable/ic_launcher" />
<ImageView
android:id="#+id/visulizationImageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="10dp"
android:layout_marginLeft="30dp"
android:src="#drawable/ic_launcher" />
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
Please try this. I hope help you.
I can see that you have used wrap_content everywhere,so u can either reduce the width and height of your images or you can define it explicitly in layout file or .java file.
For your scenario using GridLayout is better option than using RelativeLayout.try it...
Here is a good example on GridLayout :- http://www.techotopia.com/index.php/Working_with_the_Android_GridLayout_in_XML_Layout_Resources
I would suggest you should go for HorizontalScrollView which provides functionality as you want.
Checkout link shows you how you can implement HorizontolScrollView
I hope this will help you.
You can also check the answer of vijju who have shown implementation totally HERE

How to fit the image view in the screen based on android device?

I need to design the UI part in android device is,
Actually I'm having one title bar image and four piece of menu image.
I'm using relative layout for designing this menu. But every time it's having some problem to show the last image in device.
How Can I design this?Please help me.
Your should use below code for achieving it ..
<RelativeLayout 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" >
<Button
android:id="#+id/btnHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="10dip" />
<Button
android:id="#+id/btnMenu1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnHeader"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dip" />
<Button
android:id="#+id/btnMenu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnMenu1"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dip" />
<Button
android:id="#+id/btnMenu3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnMenu2"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dip" />
<Button
android:id="#+id/btnMenu4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btnMenu3"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dip" />
</RelativeLayout>
Try with the below code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/image1" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/image2"
android:layout_marginTop="10dp"
android:layout_gravity="center"/>
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/image3"
android:layout_marginTop="10dp"
android:layout_gravity="center"/>
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/image4"
android:layout_marginTop="10dp"
android:layout_gravity="center"/>
</LinearLayout>

Categories

Resources