android: Image disappears while translation animation - android

I'm trying to rotate the image as shown in the following bead images clockwise. But the problem is pretty much evident from the pictures i.e. the bead is getting disappeared.
-> -> -> ->
Following is my xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center_vertical" >
<!-- *******************************top 1 beads ************************** -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:background="#null"
android:layout_centerHorizontal="true" >
<!--
<ImageView
android:id="#+id/tasbih_thread"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="-5dp"
android:src="#drawable/tasbih_thread" />
-->
<ImageView
android:id="#+id/bead1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="81dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="65dp"
android:background="#null"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="3dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="2dp"
android:layout_marginTop="3dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#null"
android:layout_marginTop="78dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="164dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#null"
android:layout_marginTop="98dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="3dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="184dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#null"
android:layout_marginTop="120dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="3dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="148dp"
android:background="#null"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="208dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="176dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="212dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#null"
android:layout_marginTop="203dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead27"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
<RelativeLayout
android:id="#+id/allah_number_relative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tasbih_counter_star"
android:gravity="center" >
<TextView
android:id="#+id/allah_number_textview2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/green"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="210dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="228dp"
android:background="#null"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead26"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<!-- *******************************top 8 beads ************************** -->
<RelativeLayout
android:id="#+id/tableRow2"
android:layout_width="205dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#null"
android:layout_marginTop="253dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="2dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="280dp"
android:background="#null"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="194dp"
android:layout_height="wrap_content"
android:background="#null"
android:layout_centerHorizontal="true"
android:layout_marginTop="305dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="184dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#null"
android:layout_marginTop="330dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="164dp"
android:layout_height="wrap_content"
android:background="#null"
android:layout_centerHorizontal="true"
android:layout_marginTop="355dp"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="375dp"
android:background="#null"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="6dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="390dp"
android:background="#null"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="4dp"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="6dp"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
<RelativeLayout
android:layout_width="53dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="402dp"
android:background="#null"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/bead18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="#drawable/tasbih_bead_desl" />
<ImageView
android:id="#+id/bead17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/tasbih_bead_desl" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
Following is the translation function:
#Override
public void onWindowFocusChanged (boolean hasFocus){
super.onWindowFocusChanged(hasFocus);
if(hasFocus){
int[] arr=new int[2];
for(int i=0;i<33;i++)
{
((ImageView)findViewById(image_drawable[i])).getLocationOnScreen(arr);
xArrayList.add(arr[0]);
yArrayList.add(arr[1]);
Log.e("x= "+((ImageView)findViewById(image_drawable[i])).getRight(),"y= "+((ImageView)findViewById(image_drawable[i])).getBottom());
}
}
}
and following is the function to get the co-ordinates which is called onTouch of the screen:
private void startTranslateAnimation()
{
for(int i=0;i<=32;i++)
{
int x1=xArrayList.get(i);
int y1=yArrayList.get(i);
int x2,y2;
if(i<=31)
{
x2=xArrayList.get(i+1);
y2=yArrayList.get(i+1);
}
else
{
x2=xArrayList.get(0);
y2=yArrayList.get(0);
}
TranslateAnimation left_animation = new TranslateAnimation(0,x2-x1,0,y2-y1);
left_animation.setDuration(2000);
left_animation.setFillAfter(false);
findViewById(image_drawable[i]).startAnimation(left_animation);
}
}
any help?

Related

HorizontalScrollView not working

I am unable to scroll horizontally using HorizontalScrollView, but the same code in other files appears to work fine. I am unable to find an error in this file.
Here is the HorizontalScrollView xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:background="#87E886"
android:orientation="horizontal">
<HorizontalScrollView
android:id="#+id/scrollView1"
android:layout_width="2200dp"
android:layout_height="550dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<!--D2-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageView16"
android:src="#drawable/des1"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageView17"
android:src="#drawable/img_bahay"
android:layout_below="#+id/imageView16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageView18"
android:src="#drawable/des_bahay"
android:layout_below="#+id/imageView17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageView19"
android:layout_below="#+id/imageView18"
android:src="#drawable/desc_bahay"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</LinearLayout>
<ImageView
android:layout_marginTop="180dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="30dp"
android:layout_width="205dp"
android:layout_height="100dp"
android:id="#+id/xaxaw"
android:src="#drawable/arrow"
></ImageView>
<!--D3-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewa16"
android:src="#drawable/des2"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageViewa17"
android:src="#drawable/img_chinatown"
android:layout_below="#+id/imageViewa16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewa18"
android:src="#drawable/des_chinatown"
android:layout_below="#+id/imageViewa17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageViewa19"
android:src="#drawable/desc_chinatown"
android:layout_below="#+id/imageViewa18"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" />
<!-- <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Estimated Duration:"
android:id="#+id/textView13"
android:textColor="#000000"
android:layout_below="#+id/imageView19"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView14"
android:textColor="#000000"
android:layout_below="#+id/textView13"
android:layout_alignParentStart="true"
android:layout_marginLeft="35dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Estimated Distance:"
android:id="#+id/textView15"
android:textColor="#000000"
android:layout_alignTop="#+id/textView13"
android:layout_alignParentEnd="true"
android:layout_marginRight="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView16"
android:textColor="#000000"
android:layout_marginLeft="35dp"
android:layout_below="#+id/textView15"
android:layout_alignStart="#+id/textView15"/> -->
</RelativeLayout>
</LinearLayout>
<ImageView
android:layout_marginTop="180dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="30dp"
android:layout_width="205dp"
android:layout_height="100dp"
android:id="#+id/arrow1"
android:src="#drawable/arrow"
></ImageView>
<!-- D4-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaa16"
android:src="#drawable/des3"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageViewaa17"
android:src="#drawable/img_goodwill"
android:layout_below="#+id/imageViewaa16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaa18"
android:src="#drawable/des_goodwill"
android:layout_below="#+id/imageViewaa17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageViewaa19"
android:src="#drawable/desc_goodwill"
android:layout_below="#+id/imageViewaa18"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
<ImageView
android:layout_marginTop="180dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="30dp"
android:layout_width="205dp"
android:layout_height="100dp"
android:id="#+id/arrow53"
android:src="#drawable/arrow"
></ImageView>
<!--D5-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaag16"
android:src="#drawable/des4"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageViewaag17"
android:src="#drawable/img_chcemetery"
android:layout_below="#+id/imageViewaag16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaag18"
android:src="#drawable/des_chcemetery"
android:layout_below="#+id/imageViewaag17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageViewaag19"
android:src="#drawable/desc_chcemetery"
android:layout_below="#+id/imageViewaag18"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
Make HorizontalScrollView's with to "wrap_content" and maintain a single child to the HorizontalScrollView i.e.
<HorizontalScrollView
android:id="#+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
rest of the code here......
</LinearLayout>
</HorizontalScrollView>
it seems like you have forgotten to end the LinearLayout tag before ending HorizontalScrollView . Your code should look like this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:background="#87E886"
android:orientation="horizontal">
<HorizontalScrollView
android:id="#+id/scrollView1"
android:layout_width="2200dp"
android:layout_height="550dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<!--D2-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageView16"
android:src="#drawable/des1"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageView17"
android:src="#drawable/img_bahay"
android:layout_below="#+id/imageView16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageView18"
android:src="#drawable/des_bahay"
android:layout_below="#+id/imageView17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageView19"
android:layout_below="#+id/imageView18"
android:src="#drawable/desc_bahay"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</LinearLayout>
<ImageView
android:layout_marginTop="180dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="30dp"
android:layout_width="205dp"
android:layout_height="100dp"
android:id="#+id/xaxaw"
android:src="#drawable/arrow"
></ImageView>
<!--D3-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewa16"
android:src="#drawable/des2"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageViewa17"
android:src="#drawable/img_chinatown"
android:layout_below="#+id/imageViewa16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewa18"
android:src="#drawable/des_chinatown"
android:layout_below="#+id/imageViewa17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageViewa19"
android:src="#drawable/desc_chinatown"
android:layout_below="#+id/imageViewa18"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" />
<!-- <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Estimated Duration:"
android:id="#+id/textView13"
android:textColor="#000000"
android:layout_below="#+id/imageView19"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView14"
android:textColor="#000000"
android:layout_below="#+id/textView13"
android:layout_alignParentStart="true"
android:layout_marginLeft="35dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Estimated Distance:"
android:id="#+id/textView15"
android:textColor="#000000"
android:layout_alignTop="#+id/textView13"
android:layout_alignParentEnd="true"
android:layout_marginRight="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView16"
android:textColor="#000000"
android:layout_marginLeft="35dp"
android:layout_below="#+id/textView15"
android:layout_alignStart="#+id/textView15"/> -->
</RelativeLayout>
</LinearLayout>
<ImageView
android:layout_marginTop="180dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="30dp"
android:layout_width="205dp"
android:layout_height="100dp"
android:id="#+id/arrow1"
android:src="#drawable/arrow"
></ImageView>
<!-- D4-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaa16"
android:src="#drawable/des3"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageViewaa17"
android:src="#drawable/img_goodwill"
android:layout_below="#+id/imageViewaa16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaa18"
android:src="#drawable/des_goodwill"
android:layout_below="#+id/imageViewaa17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageViewaa19"
android:src="#drawable/desc_goodwill"
android:layout_below="#+id/imageViewaa18"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
<ImageView
android:layout_marginTop="180dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="30dp"
android:layout_width="205dp"
android:layout_height="100dp"
android:id="#+id/arrow53"
android:src="#drawable/arrow"
></ImageView>
<!--D5-->
<LinearLayout
android:layout_width="310dp"
android:layout_height="520dp"
android:background="#024500"
android:layout_marginLeft="10dp">
<RelativeLayout
android:layout_width="290dp"
android:layout_height="499dp"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:background="#BEFFB6"
android:layout_marginLeft="10dp"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaag16"
android:src="#drawable/des4"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<ImageView
android:layout_width="220dp"
android:layout_height="190dp"
android:id="#+id/imageViewaag17"
android:src="#drawable/img_chcemetery"
android:layout_below="#+id/imageViewaag16"
android:layout_alignParentStart="true"
android:layout_marginLeft="35sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/imageViewaag18"
android:src="#drawable/des_chcemetery"
android:layout_below="#+id/imageViewaag17"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="120dp"
android:id="#+id/imageViewaag19"
android:src="#drawable/desc_chcemetery"
android:layout_below="#+id/imageViewaag18"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
ScrollView or in your case HorizontalScrollView can only have one direct child view. Like :
<ScrollView>
<LinearLayout>
// add all the required views here.
</Linearlayout>
</Scrollview>
Although, you can add mulitiple views inside that Linear or any other layout.

TextViews Do Not Appear As Expected - Android XML

I'm not sure why this is happening - but several of the TextViews (most of the ones on the right hand side) do not appear - and I cannot seem to identify why. Can anyone spot why this might be happening?
Thanks in advance!
(any suggestions are apprecited)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/download"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:weightSum="1" >
<RelativeLayout
android:id="#+id/rl_ListView2"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/rl_ListView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:gravity="left"
android:paddingBottom="65dp" />
<ImageView
android:id="#+id/background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="right"
android:paddingBottom="65dp"
android:scaleType="fitXY" />
<ImageView
android:id="#+id/icon_dilemmas"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="646dp"
android:layout_marginTop="10dp"
android:src="#drawable/icon_dilemmas" />
<ImageView
android:id="#+id/icon_locations"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="646dp"
android:layout_marginTop="110dp"
android:src="#drawable/icon_locations" />
</RelativeLayout>
<ImageView
android:id="#+id/boxart"
android:layout_width="450dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:background="#drawable/boxart"
android:gravity="left"
android:paddingBottom="65dp" />
<RelativeLayout
android:id="#+id/rl_ListView2a"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:paddingLeft="450dp" >
</RelativeLayout>
<LinearLayout
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="#drawable/timeline_bottom_android"
android:orientation="horizontal" >
<ImageView
android:id="#+id/backbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="left"
android:src="#drawable/icon_back_arrow" />
<TextView
android:id="#+id/backButtonTxt"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignRight="#+id/saveButton"
android:gravity="center_vertical"
android:text="Movies"
android:textSize="40sp" />
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="646dp"
android:layout_marginTop="210dp"
android:src="#drawable/icon_music_top_center" />
<ImageView
android:id="#+id/icon_plotinfo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="646dp"
android:layout_marginTop="310dp"
android:src="#drawable/icon_plotinfo" />
<ImageView
android:id="#+id/icon_quotes"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="646dp"
android:layout_marginTop="410dp"
android:src="#drawable/icon_quotes" />
<ImageView
android:id="#+id/icon_recipe"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="646dp"
android:layout_marginTop="510dp"
android:src="#drawable/icon_recipe" />
<ImageView
android:id="#+id/icon_shopping"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="946dp"
android:layout_marginTop="10dp"
android:src="#drawable/icon_shopping" />
<ImageView
android:id="#+id/icon_superfan"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="946dp"
android:layout_marginTop="110dp"
android:src="#drawable/icon_superfan" />
<ImageButton
android:id="#+id/icon_trivia"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="946dp"
android:layout_marginTop="210dp"
android:src="#drawable/icon_trivia" />
<ImageView
android:id="#+id/icon_vehicles_top_center"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="946dp"
android:layout_marginTop="310dp"
android:src="#drawable/icon_vehicles_top_center" />
<ImageView
android:id="#+id/icon_weapons_top_center"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="946dp"
android:layout_marginTop="410dp"
android:src="#drawable/icon_weapons_top_center" />
<ImageView
android:id="#+id/icon_who_top_center"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="946dp"
android:layout_marginTop="510dp"
android:src="#drawable/icon_who_top_center" />
<TextView
android:id="#+id/dilemmas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="746dp"
android:layout_marginTop="10dp"
android:text="Dilemmas"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/locations"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="746dp"
android:layout_marginTop="110dp"
android:text="Locations"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/music"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="746dp"
android:layout_marginTop="210dp"
android:text="Music"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/plot_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="746dp"
android:layout_marginTop="310dp"
android:text="Plot Info"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/quotes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="746dp"
android:layout_marginTop="410dp"
android:text="Quotes"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/recipes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="746dp"
android:layout_marginTop="510dp"
android:text="Recipes"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/shopping"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="1046dp"
android:layout_marginTop="10dp"
android:text="Shopping"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/superfan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="1046dp"
android:layout_marginTop="120dp"
android:text="SuperFans"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/trivia"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="1046dp"
android:layout_marginTop="220dp"
android:text="Trivia"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/vehicles"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="1046dp"
android:layout_marginTop="320dp"
android:text="Vehicles"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/weapons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="1046dp"
android:layout_marginTop="420dp"
android:text="Weapons"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/who"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="1046dp"
android:layout_marginTop="520dp"
android:text="Who"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
</LinearLayout>

ImageViews being cut off and resized

I have a three section relative layout for a login page.
The first section at the top of the page is 1 Imageview and 2 Textviews.
The second section is 6 RelativeLayouts containing 1 ImageView to the left and 1 TextView to the right.
The third section is a Button
The first four icons are ok on any device. The 5th and 6th are both getting resized or not showing up.
I would like to see all 6 but if 1 can't fit dont add it. How can I do this in a proper way.
Thanks - P.S Code is below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/newd_login_overlay"
android:orientation="vertical" >
<LinearLayout android:id="#+id/linLoginText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/login_logo_white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_one"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_two"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linLoginFeature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/btnLoginCreate"
android:layout_below="#+id/linLoginText"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginSecurity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_security"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginSecurity"
android:layout_toEndOf="#+id/imgLoginSecurity"
android:layout_centerVertical="true"
android:text="#string/newd_login_security"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginAntivirus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_antivirus"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginAntivirus"
android:layout_toEndOf="#+id/imgLoginAntivirus"
android:layout_centerVertical="true"
android:text="#string/newd_login_antivirus"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_phone_tracker"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginTracker"
android:layout_toEndOf="#+id/imgLoginTracker"
android:layout_centerVertical="true"
android:text="#string/newd_login_booster"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBackup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_backup"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBackup"
android:layout_toEndOf="#+id/imgLoginBackup"
android:layout_centerVertical="true"
android:text="#string/newd_login_backup"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_privacy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginPrivacy"
android:layout_toEndOf="#+id/imgLoginPrivacy"
android:layout_centerVertical="true"
android:text="#string/newd_login_privacy"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBooster"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_signal_booster"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBooster"
android:layout_toEndOf="#+id/imgLoginBooster"
android:layout_centerVertical="true"
android:text="#string/newd_login_tracker"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="#+id/btnLoginCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_alignParentBottom="true"
android:background="#drawable/newd_login_btn"
android:gravity="center"
android:text="#string/newd_login_btn_text"
android:textColor="#android:color/black" />
</RelativeLayout>
Use android:layout_weight
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/newd_login_overlay"
android:orientation="vertical" >
<LinearLayout android:id="#+id/linLoginText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/login_logo_white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_one"
android:textColor="#android:color/white"
android:textSize="24sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/newd_login_text_two"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linLoginFeature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="6"
android:layout_above="#+id/btnLoginCreate"
android:layout_below="#+id/linLoginText"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="vertical" >
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginSecurity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_security"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginSecurity"
android:layout_toEndOf="#+id/imgLoginSecurity"
android:layout_centerVertical="true"
android:text="#string/newd_login_security"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginAntivirus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_antivirus"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginAntivirus"
android:layout_toEndOf="#+id/imgLoginAntivirus"
android:layout_centerVertical="true"
android:text="#string/newd_login_antivirus"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_phone_tracker"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginTracker"
android:layout_toEndOf="#+id/imgLoginTracker"
android:layout_centerVertical="true"
android:text="#string/newd_login_booster"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBackup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_backup"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBackup"
android:layout_toEndOf="#+id/imgLoginBackup"
android:layout_centerVertical="true"
android:text="#string/newd_login_backup"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_privacy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginPrivacy"
android:layout_toEndOf="#+id/imgLoginPrivacy"
android:layout_centerVertical="true"
android:text="#string/newd_login_privacy"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp">
<ImageView android:id="#+id/imgLoginBooster"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="#drawable/newd_signal_booster"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toRightOf="#+id/imgLoginBooster"
android:layout_toEndOf="#+id/imgLoginBooster"
android:layout_centerVertical="true"
android:text="#string/newd_login_tracker"
android:textColor="#android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="#+id/btnLoginCreate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_alignParentBottom="true"
android:background="#drawable/newd_login_btn"
android:gravity="center"
android:text="#string/newd_login_btn_text"
android:textColor="#android:color/black" />
</RelativeLayout>

Alignment issue when using different screen resolutions

please help me to arrange the layouts and elements which is suitable for all devices,
my current xml codes is given below.the main problem is the elements are changed when it runs on different screen resolutions`
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="2dp" >
<Button
android:id="#+id/firstimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle"
android:gravity="center"
android:scaleType="fitXY" />
<ImageView
android:id="#+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"/>
<TextView
android:id="#+id/texthere"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="helloooo"
android:textSize="15dp"
android:layout_below="#+id/firstimage"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/secondimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
<TextView
android:id="#+id/texthere2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="helloooo"
android:textSize="15dp"
android:layout_below="#+id/secondimage"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/thirdimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/second_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/first_row"
android:layout_centerHorizontal="true"
android:layout_margin="15dp"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/fourthimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/fifthimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/sixthimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/third_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/second_row"
android:layout_centerHorizontal="true"
android:layout_margin="15dp"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/sevimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/eighthimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/ninthimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smallcircle" />
<ImageView
android:id="#+id/text9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/workscam"
android:textSize="15dp" />
</RelativeLayout>
</LinearLayout>
`

Android : Relativelayout in Framelayout not showing up (Custom Camera Preview Screen)

I need same as I attached image file Its Camera Preview Screen : I want to design two transparent layout over framelayout so it looks like this, but when I run it show only camera screen(Framelayout). It not showing two relative layouts.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:layout_gravity="top"
android:padding="15dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="01"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="5dp"
android:text="Status:"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView1"
android:layout_marginRight="78dp"
android:src="#drawable/heart" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_alignLeft="#+id/imageView3"
android:layout_marginTop="10dp"
android:src="#drawable/view" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageView3"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imageView4"
android:text="125 Likes"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:text="STREAMING" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_alignTop="#+id/imageView4"
android:text="24 Viewers"
android:textColor="#color/White" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#77000000"
android:layout_gravity="bottom"
android:padding="10dp" >
<Button
android:id="#+id/button_capture"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/camera_record"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="50dp"
android:src="#drawable/view_video_big" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:src="#drawable/swipe_camera" />
</RelativeLayout>
</FrameLayout>
Add ids to the two RelativeLlayouts in layout file..
and get the view object by like this
RelativeLayout layout1=(RelativeLayout) findViewById(R.id.topRelativeLayout);
RelativeLayout layout2=(RelativeLayout) findViewById(R.id.bottomRelativeLayout);
and add this line in your onCreate and test once..
layout1.bringToFront();
layout2.bringToFront();
Try this first of all you have to set your background image to FrameLayout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="#drawable/ic_launcher"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:padding="15dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="01"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="5dp"
android:text="Status:"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView1"
android:layout_marginRight="78dp"
android:src="#drawable/heart" />
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_alignLeft="#+id/imageView3"
android:layout_marginTop="10dp"
android:src="#drawable/view" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageView3"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imageView4"
android:text="125 Likes"
android:textColor="#color/White" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:text="STREAMING" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_alignTop="#+id/imageView4"
android:text="24 Viewers"
android:textColor="#color/White" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#77000000"
android:layout_gravity="bottom"
android:visibility="visible"
android:padding="10dp" >
<Button
android:id="#+id/button_capture"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/camera_record"
android:textColor="#color/White" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="50dp"
android:src="#drawable/view_video_big" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="50dp"
android:src="#drawable/swipe_camera" />
</RelativeLayout>
</FrameLayout>
or follow this link.

Categories

Resources