I have an app that I can run on a physical ZTE Majesty Pro and it works fine, and I can run it on an AVD tablet. When I tried it on a Pixel AVD and a Nexus 5X AVD, the app crashes on startup. I don't know why this is happening, does it have something to do with the screen size? This is the layout that I believe may be affecting it. I use a lot of images for the layout, so do I need to scale down my images to make it run? If that is the case, how could I scale them down? Logcat doesn't log any data when I run it on the Pixel or Nexus either.
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/bottom_nav">
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
<ImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:id="#+id/new_spotting"
android:src="#drawable/plus"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:background="#ffffff"
android:contentDescription="#string/spotting"
android:onClick="onClick"/>
<View
android:layout_width="match_parent"
android:layout_height="85dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dp"
android:background="#44ba52"/>
<View
android:layout_width="100dp"
android:layout_height="120dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:id="#+id/map_background"
android:background="#drawable/curvelines"/>
<ImageView
android:id="#+id/HomeButton"
android:layout_width="100dp"
android:layout_height="75dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:contentDescription="#string/home"
android:onClick="onClick"
android:scaleType="fitCenter"
android:src="#drawable/homebutton" />
<ImageView
android:id="#+id/MapButton"
android:layout_width="145dp"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:contentDescription="#string/map"
android:padding="5dp"
android:layout_marginBottom="20dp"
android:onClick="onClick"
android:scaleType="fitCenter"
android:src="#drawable/mapbutton" />
<ImageView
android:id="#+id/MenuButton"
android:onClick="onClick"
android:layout_width="100dp"
android:layout_height="75dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:src="#drawable/menubutton"
android:contentDescription="#string/menu"
android:scaleType="fitCenter"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:id="#+id/new_spotting_page"
android:visibility="visible">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add a New Sighting"
android:textColor="#000000"
android:fontFamily="monospace"
android:textSize="30sp"
android:gravity="center" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Type of Animal:"
android:textColor="#000000"
android:fontFamily="monospace"
android:textSize="15sp"
android:gravity="start"
android:layout_marginTop="5dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="40dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:id="#+id/moose_select"
android:padding="5dp"
android:onClick="onClick">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/moose"
android:id="#+id/moose"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_margin="15dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Moose"
android:textColor="#000000"
android:textSize="20sp"
android:fontFamily="monospace"
android:layout_alignLeft="#+id/moose"
android:layout_alignStart="#+id/moose"
android:layout_alignRight="#+id/moose"
android:layout_alignEnd="#+id/moose"
android:layout_alignParentBottom="true"
android:layout_margin="5dp"
android:gravity="center"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:id="#+id/bear_select"
android:layout_centerHorizontal="true"
android:padding="5dp"
android:onClick="onClick">
<ImageView
android:layout_width="100dp"
android:id="#+id/bear"
android:layout_height="100dp"
android:src="#drawable/bear"
android:layout_margin="15dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bear"
android:textColor="#000000"
android:textSize="20sp"
android:fontFamily="monospace"
android:layout_alignLeft="#+id/bear"
android:layout_alignStart="#+id/bear"
android:layout_alignRight="#+id/bear"
android:layout_alignEnd="#+id/bear"
android:layout_alignParentBottom="true"
android:layout_margin="5dp"
android:gravity="center"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="#+id/deer_select"
android:padding="5dp"
android:onClick="onClick">
<ImageView
android:layout_width="100dp"
android:id="#+id/deer"
android:layout_height="100dp"
android:src="#drawable/deer"
android:layout_margin="15dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Deer"
android:textColor="#000000"
android:textSize="20sp"
android:fontFamily="monospace"
android:layout_alignLeft="#+id/deer"
android:layout_alignStart="#+id/deer"
android:layout_alignRight="#+id/deer"
android:layout_alignEnd="#+id/deer"
android:layout_alignParentBottom="true"
android:layout_margin="5dp"
android:gravity="center"/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:id="#+id/coyote_select"
android:padding="5dp"
android:onClick="onClick">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/coyote"
android:id="#+id/coyote"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_margin="15dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Coyote"
android:textColor="#000000"
android:textSize="20sp"
android:fontFamily="monospace"
android:layout_alignLeft="#+id/coyote"
android:layout_alignStart="#+id/coyote"
android:layout_alignRight="#+id/coyote"
android:layout_alignEnd="#+id/coyote"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:gravity="center"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:id="#+id/lion_select"
android:layout_centerHorizontal="true"
android:layout_marginHorizontal="15dp"
android:padding="5dp"
android:onClick="onClick">
<ImageView
android:layout_width="100dp"
android:id="#+id/lion"
android:layout_height="100dp"
android:src="#drawable/lion"
android:scaleType="centerCrop"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Puma"
android:textColor="#000000"
android:textSize="20sp"
android:fontFamily="monospace"
android:layout_alignLeft="#+id/lion"
android:layout_alignStart="#+id/lion"
android:layout_alignRight="#+id/lion"
android:layout_alignEnd="#+id/lion"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:gravity="center"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="150dp"
android:id="#+id/fox_select"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginHorizontal="15dp"
android:padding="5dp"
android:onClick="onClick">
<ImageView
android:layout_width="100dp"
android:id="#+id/fox"
android:layout_height="100dp"
android:src="#drawable/fox"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Fox"
android:textColor="#000000"
android:textSize="20sp"
android:fontFamily="monospace"
android:layout_alignLeft="#+id/fox"
android:layout_alignStart="#+id/fox"
android:layout_alignRight="#+id/fox"
android:layout_alignEnd="#+id/fox"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:gravity="center"/>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp">
<Button
android:id="#+id/cancel"
android:onClick="onClick"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/add"
android:layout_toRightOf="#+id/spacer"
android:layout_toEndOf="#+id/spacer"
android:text="Cancel"
android:textSize="18sp"/>
<View
android:id="#+id/spacer"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_centerHorizontal="true" />
<Button
android:id="#+id/add"
android:onClick="onClick"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="#+id/spacer"
android:layout_toStartOf="#+id/spacer"
android:text="Add to Map"
android:textSize="18sp"/>
</RelativeLayout>
</TableLayout>
Please provide the error log from Logcat.
Are you implementing and using any Google Service? If yes check if your Virtual Device has the Google API.
Related
I am learning from Udacity, I have learned so far LinearLayout and RelativeLayout. Based on this I tried to create an xml for a project. I created it according to preview from inside Android Studio Nexus 5X. Then when I run this in Emulator Nexus 5X again I see different output the project was created according to API 15. Then when I run it on my Android phone I see it as on preview. Following I will post the outcomes:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:id="#+id/background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
app:srcCompat="#drawable/background" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/topScore"
android:layout_width="350dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginBottom="15dp"
android:layout_weight="5">
<ImageView
android:id="#+id/topImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/topscore" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="18dp"
android:gravity="center"
android:text="0 - 0"
android:textColor="#android:color/background_light"
android:textSize="26dp" />
<ImageButton
android:id="#+id/arrowRightScore"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="30dp"
android:layout_marginRight="6dp"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<ImageButton
android:id="#+id/arrowLeftScore"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="6dp"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row1"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row1"
android:layout_alignTop="#id/row1"
android:layout_alignRight="#id/row1"
android:layout_alignBottom="#id/row1"
android:layout_margin="1dp"
android:gravity="center"
android:text="SHOTS"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow1"
android:layout_width="52dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row1"
android:layout_alignRight="#+id/arrowLeftRow1"
android:layout_alignBottom="#id/row1"
android:layout_marginTop="0dp"
android:layout_marginRight="-35dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow1"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row1"
android:layout_alignBottom="#id/row1"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow1"
android:layout_alignTop="#id/row1"
android:layout_alignBottom="#id/row1"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row2"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row2"
android:layout_alignTop="#id/row2"
android:layout_alignRight="#id/row2"
android:layout_alignBottom="#id/row2"
android:layout_margin="1dp"
android:gravity="center"
android:text="FOULS"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow2"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row2"
android:layout_alignBottom="#id/row2"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row2"
android:layout_alignRight="#+id/arrowLeftRow2"
android:layout_alignBottom="#id/row2"
android:layout_marginTop="0dp"
android:layout_marginRight="-45dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow2"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row2"
android:layout_alignBottom="#id/row2"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow2"
android:layout_alignTop="#id/row2"
android:layout_alignBottom="#id/row2"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row3"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row3"
android:layout_alignTop="#id/row3"
android:layout_alignRight="#id/row3"
android:layout_alignBottom="#id/row3"
android:layout_margin="1dp"
android:gravity="center"
android:text="CORNERS"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow3"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row3"
android:layout_alignBottom="#id/row3"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row3"
android:layout_alignRight="#+id/arrowLeftRow3"
android:layout_alignBottom="#id/row3"
android:layout_marginTop="0dp"
android:layout_marginRight="-45dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow3"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row3"
android:layout_alignBottom="#id/row3"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow3"
android:layout_alignTop="#id/row3"
android:layout_alignBottom="#id/row3"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_marginBottom="25dp"
android:layout_weight="1">
<ImageView
android:id="#+id/row4"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="#drawable/row" />
<TextView
android:id="#+id/textRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/row4"
android:layout_alignTop="#id/row4"
android:layout_alignRight="#id/row4"
android:layout_alignBottom="#id/row4"
android:layout_margin="1dp"
android:gravity="center"
android:text="OFFSIDES"
android:textColor="#000000"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowLeftRow4"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row4"
android:layout_alignBottom="#id/row4"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row4"
android:layout_alignRight="#+id/arrowLeftRow4"
android:layout_alignBottom="#id/row4"
android:layout_marginTop="0dp"
android:layout_marginRight="-45dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
<ImageButton
android:id="#+id/arrowRightRow4"
android:layout_width="35dp"
android:layout_height="wrap_content"
android:layout_alignTop="#id/row4"
android:layout_alignBottom="#id/row4"
android:layout_alignParentRight="true"
android:background="#android:color/transparent"
android:src="#android:drawable/arrow_up_float" />
<TextView
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/arrowRightRow4"
android:layout_alignTop="#id/row4"
android:layout_alignBottom="#id/row4"
android:layout_marginLeft="-45dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:gravity="center"
android:text="0"
android:textColor="#ffff"
android:textSize="18dp" />
</RelativeLayout>
<Button
android:id="#+id/buttonReset"
android:layout_width="150sp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_margin="50dp"
android:layout_marginBottom="5dp"
android:layout_weight="0.5"
android:background="#drawable/reset"
android:text="RESET"
android:textColor="#cdc2b1"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
What I get from preview:
What I get from Emulator:
What I get from my Android Phone:
I found that I have used on top
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
That pushed 10dp the layout inside. Then I used static 390dp in RelativeLayout and that probably pushed outside the image living the arrows out of place.
<RelativeLayout
android:layout_width="390dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginBottom="25dp"
android:layout_weight="1">
By removing android:layout_margin="10dp" from top LinearLayout it looked fine now in Android's Studio emulator also! So in case you see similar problem check margins in parent Layouts
i have a linear layout which is linked to an activity and i want to draw a line over it from a view class using addview but the problem is that when i add using addview then it shift the whole screen upwards. I want to draw a line at specific position without changing the layout. if this can we done by any other method that will be ok. Please help. Also tell that how to remove a Addview.
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
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:weightSum="7"
android:background="#mipmap/untitled_3"
android:id="#+id/multiplayer_game_activity"
tools:context="com.bussiness.vidit.ticktacknoughtsandcrosses.Multiplayer_game">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_weight="1.18"
android:weightSum="3">
<TextView
android:id="#+id/reset_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/name_tv"
android:layout_alignBottom="#+id/name_tv"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:onClick="reset"
android:text="RESET"
android:textColor="#android:color/holo_blue_bright"
android:textSize="10sp" />
<TextView
android:id="#+id/name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textColor="#android:color/white"
android:textSize="18sp"
android:layout_alignBaseline="#+id/turn_tv"
android:layout_alignBottom="#+id/turn_tv"
android:layout_toRightOf="#+id/turn_tv"
android:layout_toEndOf="#+id/turn_tv" />
<TextView
android:id="#+id/turn_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="9dp"
android:layout_marginStart="9dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:text="TURN - "
android:textColor="#android:color/holo_purple"
android:textSize="15sp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:weightSum="3"
android:layout_weight="0.87">
<ImageView
android:id="#+id/iv1"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="#+id/iv2"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="#+id/iv3"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:weightSum="3"
android:layout_weight="0.68">
<ImageView
android:id="#+id/iv4"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="#+id/iv5"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="#+id/iv6"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:weightSum="3"
android:layout_weight="0.80">
<ImageView
android:id="#+id/iv7"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="#+id/iv8"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="#+id/iv9"
android:layout_width="20dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_weight="4">
<com.google.android.gms.ads.AdView
android:id="#+id/adView_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="#string/banner_home_footer"
android:layout_marginBottom="30dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"></com.google.android.gms.ads.AdView>
<ImageView
android:id="#+id/imageView4"
android:layout_width="75dp"
android:layout_height="45dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="25dp"
android:layout_marginStart="25dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:src="#drawable/cross" />
<TextView
android:id="#+id/cross_win_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView4"
android:layout_alignStart="#+id/imageView4"
android:layout_below="#+id/imageView4"
android:layout_marginLeft="29dp"
android:layout_marginStart="29dp"
android:text="0"
android:textColor="#android:color/holo_green_light"
android:textSize="25dp" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="75dp"
android:layout_height="50dp"
android:layout_above="#+id/cross_win_tv"
android:layout_centerHorizontal="true"
android:layout_weight="1"
android:src="#drawable/circle" />
<TextView
android:id="#+id/cirle_win_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView5"
android:layout_centerHorizontal="true"
android:text="0"
android:textColor="#android:color/holo_red_light"
android:textSize="25dp" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/imageView4"
android:layout_marginEnd="11dp"
android:layout_marginRight="11dp"
android:text="Draws"
android:textColor="#android:color/holo_orange_light"
android:textSize="25dp" />
<TextView
android:id="#+id/draw_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView4"
android:layout_alignStart="#+id/textView4"
android:layout_below="#+id/imageView5"
android:layout_marginLeft="27dp"
android:layout_marginStart="27dp"
android:text="0"
android:textColor="#android:color/holo_orange_light"
android:textSize="25dp" />
</RelativeLayout>
I couldn't get exactly what you want. I assume that you want to draw a "1 px line". If so, you can do it like this:
<View
android:background="#ffffff"
android:layout_width="match_parent"
android:layout_height="1dp" />
i have this layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#color/black_30">
<android.support.v7.widget.Toolbar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:id="#+id/toolbarAnnouncement"
android:theme="#style/ToolBarStyle"
android:elevation="5dp"
android:textAlignment="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_gravity="center"
android:id="#+id/toolbar_title"
android:textSize="20sp"
android:textStyle="bold"
android:background="#00000000"
android:textColor="#ffffff" />
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="15"
android:id="#+id/channelContainer"
android:orientation="horizontal"
android:layout_below="#+id/toolbarAnnouncement"
android:background="#color/black_30">
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="To :"
android:id="#+id/textView16"
android:textSize="20sp"
android:paddingLeft="5dp"
android:layout_gravity="center_vertical" />
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="11"
android:id="#+id/chipViewLayout"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<com.plumillonforge.android.chipview.ChipView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/buttonChannelSelectorAnnouncement"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="left"
android:padding="5dp"
android:minHeight="90dp" />
</RelativeLayout>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:id="#+id/buttonRemoveChannel"
android:background="#android:drawable/ic_menu_close_clear_cancel"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage1"
android:layout_below="#+id/channelContainer"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach1"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/location" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attached."
android:id="#+id/textViewAttach1"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach1"
android:layout_toEndOf="#+id/imageViewAttach1"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remove"
android:id="#+id/buttonAttach1"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach1"
android:layout_above="#+id/textViewAttach1"
android:layout_alignLeft="#+id/textViewAttach1"
android:layout_toLeftOf="#+id/buttonAttach1"
android:layout_toStartOf="#+id/buttonAttach1"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="100" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage2"
android:layout_below="#+id/attacheImage1"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach2"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAtttach2"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach2"
android:layout_toEndOf="#+id/imageViewAttach2"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach2"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach2"
android:layout_above="#+id/textViewAtttach2"
android:layout_alignLeft="#+id/textViewAtttach2"
android:layout_toLeftOf="#+id/buttonAttach2"
android:layout_toStartOf="#+id/buttonAttach2"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="77" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage3"
android:layout_below="#+id/attacheImage2"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach3"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/icon_admin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAttach3"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach3"
android:layout_toEndOf="#+id/imageViewAttach3"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach3"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach3"
android:layout_above="#+id/textViewAttach3"
android:layout_alignLeft="#+id/textViewAttach3"
android:layout_toLeftOf="#+id/buttonAttach3"
android:layout_toStartOf="#+id/buttonAttach3"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="43" />
</RelativeLayout>
<EditText
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:inputType="textMultiLine"
android:ems="10"
android:fitsSystemWindows="true"
android:id="#+id/editText"
android:hint="write from here..."
android:gravity="top"
android:padding="5dp"
android:layout_above="#+id/relativeLayout4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="#+id/attacheImage3"
android:background="#ffffff" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#color/button_material_light"
android:id="#+id/relativeLayout4">
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Image"
android:id="#+id/buttonAddImage"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Send"
android:id="#+id/button2"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
and in my layout when i start editing my editText every other layout moves up with keyboard but not the layout that is on bottom(with 2 buttons), i want it to move up too , so that it can be visible while editing my editText
any idea how i can i do this ?? my manifest for my activity :
<activity android:name=".myActivity"
android:theme="#style/AppTheme.NoActionBar"/>
what i actually need looks like this :
SEE THAT THING ON THE BOTTOM IN IOS WE CALL IT INPUT ACCESSORY
and when editing starts :
THAT LAYOUT MOVES UP WITH KEYBOARD
and what i have is this :
and when editing starts :
Try to use that new XML Layout File:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#color/black_30">
<android.support.v7.widget.Toolbar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:id="#+id/toolbarAnnouncement"
android:elevation="5dp"
android:theme="#style/ToolBarStyle"
android:textAlignment="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_gravity="center"
android:id="#+id/toolbar_title"
android:textSize="20sp"
android:textStyle="bold"
android:background="#00000000"
android:textColor="#ffffff" />
</android.support.v7.widget.Toolbar>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:weightSum="15"
android:id="#+id/channelContainer"
android:orientation="horizontal"
android:layout_below="#+id/toolbarAnnouncement"
android:background="#color/black_30"
android:layout_weight="0.20">
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="To :"
android:id="#+id/textView16"
android:textSize="20sp"
android:paddingLeft="5dp"
android:layout_gravity="center_vertical" />
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="11"
android:id="#+id/chipViewLayout"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<com.plumillonforge.android.chipview.ChipView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/buttonChannelSelectorAnnouncement"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="left"
android:padding="5dp"
android:minHeight="90dp" />
</RelativeLayout>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:id="#+id/buttonRemoveChannel"
android:background="#android:drawable/ic_menu_close_clear_cancel"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage1"
android:layout_below="#+id/channelContainer"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach1"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/location" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attached."
android:id="#+id/textViewAttach1"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach1"
android:layout_toEndOf="#+id/imageViewAttach1"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remove"
android:id="#+id/buttonAttach1"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach1"
android:layout_above="#+id/textViewAttach1"
android:layout_alignLeft="#+id/textViewAttach1"
android:layout_toLeftOf="#+id/buttonAttach1"
android:layout_toStartOf="#+id/buttonAttach1"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="100" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage2"
android:layout_below="#+id/attacheImage1"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach2"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAtttach2"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach2"
android:layout_toEndOf="#+id/imageViewAttach2"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach2"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach2"
android:layout_above="#+id/textViewAtttach2"
android:layout_alignLeft="#+id/textViewAtttach2"
android:layout_toLeftOf="#+id/buttonAttach2"
android:layout_toStartOf="#+id/buttonAttach2"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="77" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage3"
android:layout_below="#+id/attacheImage2"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach3"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/icon_admin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAttach3"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach3"
android:layout_toEndOf="#+id/imageViewAttach3"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach3"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach3"
android:layout_above="#+id/textViewAttach3"
android:layout_alignLeft="#+id/textViewAttach3"
android:layout_toLeftOf="#+id/buttonAttach3"
android:layout_toStartOf="#+id/buttonAttach3"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="43" />
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.70">
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:inputType="textMultiLine"
android:fitsSystemWindows="true"
android:id="#+id/editText"
android:hint="write from here..."
android:gravity="top"
android:padding="5dp"
android:background="#ffffff"
android:ems="10"
android:layout_weight="0.80"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#color/button_material_light"
android:id="#+id/relativeLayout4">
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Image"
android:id="#+id/buttonAddImage"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Send"
android:id="#+id/button2"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
This is because of you set android:layout_alignParentBottom="true" to relativeLayout4 this won't allow it to scroll upwards. Set Top margin according to your needs or Take Linearlayout and adjust layout by weightsum property and layout_weight property.
Android noob here.
I am using an image in an image view.
Image Specs: 750x500 PNG 835.36kb
It displays correctly on all device emulators and on the real device during debug. However after release it doesn't appear to show on some devices.
It's image with src 'main22' which is causing the issues.
Any help resolving this would be much appreciated!
I am using the following xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.mattblack.fibreapp.MainActivity"
android:background="#000000">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:src="#drawable/main22"
android:layout_gravity="center_horizontal"
android:layout_above="#+id/frameLayout"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:adjustViewBounds="false"
android:cropToPadding="false"
android:layout_below="#+id/frameLayout6"
android:nestedScrollingEnabled="false"
android:scaleType="fitXY" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:background="#ffffff"
android:id="#+id/frameLayout"
android:layout_gravity="center_horizontal"
android:layout_above="#+id/frameLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="INACTIVE"
android:id="#+id/qjumpButton"
android:layout_gravity="center"
android:textColor="#000000"
android:background="#ffffff"
android:textSize="30sp"
android:typeface="normal"
android:onClick="clickFunction"
android:enabled="true"
android:clickable="true"
style="?android:attr/borderlessButtonStyle"
android:textStyle="normal"
android:layout_marginBottom="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Queue Jump"
android:id="#+id/textView2"
android:layout_gravity="center_horizontal|bottom"
android:textSize="20sp"
android:textColor="#e4c353"
android:layout_marginBottom="15dp" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="130dp"
android:id="#+id/frameLayout2"
android:layout_gravity="center_horizontal"
android:layout_above="#+id/frameLayout3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<ImageView
android:layout_width="100dp"
android:layout_height="80dp"
android:id="#+id/shakeImage"
android:layout_gravity="center"
android:src="#drawable/shake"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WINNER!"
android:id="#+id/winnerText"
android:layout_gravity="center_horizontal"
android:textColor="#ffffff"
android:textSize="30sp"
android:visibility="invisible"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1 x The Prize"
android:id="#+id/prizeText"
android:layout_gravity="center"
android:textColor="#ffffff"
android:textSize="20sp"
android:visibility="invisible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show at the Bar to Claim before we close."
android:id="#+id/claimText"
android:layout_gravity="center_horizontal|bottom"
android:textColor="#ffffff"
android:visibility="invisible"
android:layout_marginBottom="15dp"
android:textSize="12dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NO WIN"
android:id="#+id/nowinText"
android:layout_gravity="center_horizontal|top"
android:textColor="#ffffff"
android:textSize="40sp"
android:layout_marginTop="30dp"
android:visibility="invisible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Try Again Tomorrow."
android:id="#+id/tryagainText"
android:layout_gravity="center_horizontal|bottom"
android:textColor="#ffffff"
android:textSize="12sp"
android:layout_marginBottom="20dp"
android:visibility="invisible" />
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/down"
android:layout_gravity="center"
android:alpha="0.1"
android:enabled="true"
android:clickable="true"
android:visibility="invisible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Shake Again Tomorrow."
android:id="#+id/shakeTomorrowText"
android:layout_gravity="center"
android:textSize="15sp"
android:textColor="#ffffff"
android:visibility="invisible" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#ffffff"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/frameLayout3">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="HOME"
android:id="#+id/button"
android:layout_gravity="left|center_vertical"
android:background="#ffffff" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CODE"
android:id="#+id/button9"
android:layout_gravity="right|center_vertical"
android:background="#ffffff"
android:onClick="profilePageClick" />
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="true"
android:layout_alignParentStart="false"
android:layout_alignParentTop="true"
android:background="#ffffff"
android:id="#+id/frameLayout6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FIBRE"
android:id="#+id/textView"
android:layout_gravity="center"
android:textSize="25sp"
android:textColor="#d9bc00" />
</FrameLayout>
</RelativeLayout>
I was facing the same issue. In my case the image was very large in size and that was the reason image was not showing on some device. Just reduce the image size and it will work.
I have developed an app that works perfectly on Lollipop. However, I am experiencing some strange glitches on kitkat (api 19)
When I run my app on the kitkat device, it shows my card view for a split second then it disappears.
below is my xml layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:bootstrap="http://schemas.android.com/apk/res-auto"
xmlns:fontawesometext="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
tools:context="com.running.mattboyle.runnertoolbox.RunningMap">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_viewrunning"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/backgroundcard"
card_view:cardCornerRadius="4dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Chronometer
android:id="#+id/Duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:paddingLeft="10dp"
android:text="0:00"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/Calories"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="14dp"
android:layout_marginTop="60dp"
android:text="Calories: 0" />
<TextView
android:id="#+id/pace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_alignParentRight="true"
android:text="0:00"
android:layout_marginEnd="60dp" />
<TextView
android:id="#+id/paceunits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:text="min/km"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp" />
<TextView
android:id="#+id/distanceText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#id/Duration"
android:layout_marginTop="52dp"
android:text="0.00"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/distanceUnits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Duration"
android:layout_marginTop="12dp"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#id/distanceText"
android:text="KM"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="#+id/runButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
android:text="Begin Run"
android:layout_centerInParent="true"
bootstrap:bb_type="primary" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="#+id/pauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:text="Pause"
android:layout_centerHorizontal="true"
android:paddingRight="120dp"
bootstrap:bb_type="warning" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="#+id/EndButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:paddingLeft="120dp"
android:text="End Run"
bootstrap:bb_type="success"
/>
</RelativeLayout>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:paddingBottom="40dp">
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="#+id/right"
android:layout_width="70dp"
android:layout_margin="10dp"
android:layout_height="wrap_content"
bootstrap:bb_type="primary"
fontawesometext:fa_icon="fa-forward"
android:text="Next"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp" />
<TextView
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Calculating....."
android:id="#+id/runLength"
android:layout_centerHorizontal="true" />
<com.beardedhen.androidbootstrap.BootstrapButton
android:layout_width="70dp"
android:layout_height="wrap_content"
bootstrap:bb_type="primary"
android:text="Last"
fontawesometext:fa_icon="fa-backward"
android:id="#+id/left"
android:layout_alignParentLeft="true"
android:layout_marginStart="10dp" />
</RelativeLayout>
</RelativeLayout>
What's extra weird is I have a cardview on my home screen too that opens and works just fine:
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="180dp"
android:background="#drawable/backgroundcard"
card_view:cardCornerRadius="4dp">
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#drawable/vertical_divider"
android:dividerPadding="12dip"
android:showDividers="middle">
<TextView
android:id="#+id/weather"
android:textColor="#android:color/primary_text_light"
android:paddingTop="10dp"
android:paddingLeft="15dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Weather"
android:textSize="25dp"
/>
<TextView
android:id="#+id/location"
android:textColor="#android:color/darker_gray"
android:paddingTop="130dp"
android:paddingLeft="40dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Birmingham,UK"
/>
<ImageView
android:layout_width="130dp"
android:layout_height="130dp"
android:background="#drawable/nightcloud"
android:layout_marginTop="25dp"
android:layout_marginLeft="20dp"
android:layout_centerVertical="true"
android:id="#+id/weatherImage" />
<TextView
android:id="#+id/low"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="05\u00B0"
android:paddingTop="75dp"
android:paddingRight="20dp"
android:layout_alignParentEnd="true"
android:textColor="#android:color/primary_text_light"
/>
<TextView
android:id="#+id/high"
android:textColor="#android:color/primary_text_light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10\u00B0"
android:paddingTop="95dp"
android:paddingRight="20dp"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/current"
android:textColor="#android:color/darker_gray"
android:textSize="50dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10\u00B0"
android:paddingRight="50dp"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/judgement"
android:paddingTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#android:color/darker_gray"
android:text="Wear an underlayer, it is cold!"
android:paddingBottom="5dp"
android:paddingLeft="15dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Log cat doesn't offer any complaints.
Android Studio documents this too:
Api 19
api 21
Any ideas? Would really appreciate any assistance.
EDIT: I tried adding the line findViewById(R.id.card_viewrunning).setVisibility(View.VISIBLE); to no prevail.
Once again, this works perfectly on an api 21 device. Very strange one.
Look at the component tree tab on the right in android studio for your layout in v19. Select your cardview and look on the visual editor, it should be highlighted. My guess is it's hidden behind the fragment.