I'm kinda new with android programming and I can figure out many problems thanks to StackOverflow. But there's a thing where I keep struggle : Layouts.
I use DP as advised but it looks like it's not the ultimate solution.
See below, my XML code and what it what it looks like on my Nexus 5X :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
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="com.example.damien.dartscorer.MainActivity"
android:clipToPadding="false">
<View
android:layout_width="match_parent"
android:layout_height="350dp"
android:background="#b71c1c"/>
<ImageView
android:id="#+id/mask"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="24dp"
android:scaleType="fitCenter"
android:src="#drawable/targe_mask"
android:visibility="invisible"
android:layout_marginBottom="280dp"/>
<ImageView
android:id="#+id/target"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="24dp"
android:scaleType="fitCenter"
android:src="#drawable/target"
android:visibility="visible"
android:layout_marginBottom="280dp"/>
<TextView
android:id="#+id/pointTextView"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="15dp"
android:layout_marginVertical="90dp"
android:background="#drawable/pressed_button"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:textColor="#android:color/white"
android:textSize="20sp"
android:visibility="invisible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="315dp">
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1">
</Space>
<Button
android:id="#+id/button_x2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/pressed_button"
android:onClick="timesTwoClick"
android:text="x2"
android:textStyle="bold"
android:textSize="18dp"
android:textColor="#ffebee" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1">
</Space>
<Button
android:id="#+id/btn_25"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/halfb"
android:elevation="9dp"/>
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1">
</Space>
<Button
android:id="#+id/btn_missed"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/zero" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1">
</Space>
<Button
android:id="#+id/btn_50"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/bull" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1">
</Space>
<Button
android:id="#+id/button_x3"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/pressed_button"
android:onClick="timesThreeClick"
android:text="x3"
android:textStyle="bold"
android:textSize="18dp"
android:textColor="#ffebee" />
<Space
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1">
</Space>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="230dp"
android:layout_gravity="bottom">
<TextView
android:id="#+id/playerName1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="60dp"
android:layout_marginTop="32dp"
android:text="Player"
android:visibility="visible"
android:textSize="24sp" />
<TextView
android:id="#+id/playerName2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="60dp"
android:layout_marginTop="32dp"
android:text="Player"
android:visibility="visible"
android:textSize="24sp" />
<TextView
android:id="#+id/playerName3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/scoreC"
android:layout_marginStart="60dp"
android:text="Player"
android:visibility="visible"
android:textSize="24sp" />
<TextView
android:id="#+id/playerName4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/scoreD"
android:layout_alignParentEnd="true"
android:layout_marginEnd="60dp"
android:text="Player"
android:visibility="visible"
android:textSize="24sp" />
<TextView
android:id="#+id/scoreA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/playerName1"
android:layout_marginStart="60dp"
android:visibility="visible"
android:textSize="18sp"
android:text="Pts" />
<TextView
android:id="#+id/scoreB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="#+id/playerName2"
android:layout_marginBottom="24dp"
android:layout_marginEnd="60dp"
android:visibility="visible"
android:textSize="18sp"
android:text="Pts" />
<TextView
android:id="#+id/scoreC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="32dp"
android:layout_marginStart="60dp"
android:visibility="visible"
android:textSize="18sp"
android:text="Pts" />
<TextView
android:id="#+id/scoreD"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="32dp"
android:layout_marginEnd="60dp"
android:textSize="18sp"
android:visibility="visible"
android:text="Pts" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/winLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DD000000">
</View>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="32dp"
android:textColor="#FFEAED"
android:layout_centerHorizontal="true"
android:layout_marginTop="150dp"
android:id="#+id/winner" />
<Button
android:id="#+id/btn_replay"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_below="#+id/winner"
android:layout_centerHorizontal="true"
android:layout_marginTop="140dp"
android:background="#drawable/replay" />
<Button
android:id="#+id/btn_home"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_below="#+id/btn_replay"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:background="#drawable/home" />
</RelativeLayout>
</FrameLayout>
As you can see on this second image, the layout sucks on a Pixel and yet, the screen don't have huge difference ! So how can I build something a minimum consistent ?
Also, I can't add elevation to my buttons and i don't really know why.
Thanks for helping,
Damien
This is not how an Android XML layout should be, this code does not follow guidelines for UI development like parent and child elements. Please check some codes of XML layouts first then try developing with that.
<?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"
android:clipToPadding="false">
<LinearLayout
android:id="#+id/ll_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:layout_width="match_parent"
android:layout_height="350dp"
android:background="#b71c1c"/>
</LinearLayout>
<TextView
android:id="#+id/tv_1"
android:layout_below="#+id/ll_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Some data"/>
<TextView
android:layout_below="#+id/ll_top"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:text="some other data"/>
</RelativeLayout>
this is a sample code just try this and stud it by changing parameters
Related
I don't get the accurate view as like my Figma design. Constraint layout cuts out some of my views and also is not matching with top Search bar as I designed with Linear Layout. What should I do for pixel perfect design as like my Figma design?
The Figma design of my project:
Portrait view after run:
Landscape view after run:
My code:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:background="#color/teal_200"
tools:context=".MainActivity">
<LinearLayout
android:id="#+id/menubar"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_marginTop="20dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:background="#drawable/ic_circle_white"
android:layout_marginStart="20dp"
android:layout_marginEnd="13dp">
<ImageView
android:layout_width="16dp"
android:layout_height="9dp"
android:layout_centerInParent="true"
android:src="#drawable/ic_menu"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="265dp"
android:layout_height="46dp"
android:layout_weight="1"
android:background="#drawable/rounded_shape1"
android:verticalScrollbarPosition="right">
<ImageView
android:id="#+id/ic_search"
android:layout_width="12dp"
android:layout_height="14dp"
android:src="#drawable/ic_search"
android:layout_centerVertical="true"
android:layout_marginStart="15dp"/>
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/search_txtinput"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toEndOf="#id/ic_search"
android:background="#android:color/transparent"
android:fontFamily="#font/poppins_medium"
android:hint="Search or type address"
android:textSize="13dp"
android:paddingStart="13dp"
android:paddingTop="3dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:background="#drawable/ic_circle_white"
android:layout_marginStart="13dp"
android:layout_marginEnd="20dp">
<ImageView
android:layout_width="13dp"
android:layout_height="13dp"
android:layout_centerInParent="true"
android:src="#drawable/ic_rounded_pg_bg"/>
</RelativeLayout>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="40dp"
android:paddingStart="19dp"
android:paddingEnd="19dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/fb_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.25"
app:layout_constraintEnd_toStartOf="#id/yt_btn"
tools:layout_editor_absoluteY="40dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/fblogo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#drawable/ic_circle_white">
<ImageView
android:layout_width="8dp"
android:layout_height="18dp"
android:layout_centerInParent="true"
android:src="#drawable/fb_logo" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins_medium"
android:paddingTop="9dp"
android:text="Facebook"
android:textSize="12.3dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/yt_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="48dp"
app:layout_constraintStart_toEndOf="#id/fb_btn"
app:layout_constraintEnd_toStartOf="#id/twitter_btn"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.25"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/ytlogo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#drawable/ic_circle_white">
<ImageView
android:layout_width="10dp"
android:layout_height="12dp"
android:src="#drawable/yt_logo"
android:layout_centerInParent="true"/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12.3dp"
android:text="Youtube"
android:paddingTop="9dp"
android:fontFamily="#font/poppins_medium"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/twitter_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="50dp"
app:layout_constraintStart_toEndOf="#id/yt_btn"
app:layout_constraintEnd_toStartOf="#id/insta_btn"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.25"
tools:layout_editor_absoluteY="40dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/twtrlogo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#drawable/ic_circle_white">
<ImageView
android:layout_width="18dp"
android:layout_height="14dp"
android:layout_centerInParent="true"
android:src="#drawable/twitter_logo" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins_medium"
android:paddingTop="9dp"
android:text="Twitter"
android:textSize="12.3dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/insta_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="48dp"
app:layout_constraintWidth_percent="0.25"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="#id/twitter_btn"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/instalogo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#drawable/ic_circle_white">
<ImageView
android:layout_width="21dp"
android:layout_height="21dp"
android:src="#drawable/insta_logo"
android:layout_centerInParent="true"/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12.3dp"
android:text="Instagram"
android:paddingTop="9dp"
android:fontFamily="#font/poppins_medium"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Removed the start padding from each Linear Layout (parents of logos and names), and that solved the problem.
Code:
<LinearLayout
android:id="#+id/twitter_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
<!-- android:paddingStart="50dp"[Removed paddingstart] -->
app:layout_constraintStart_toEndOf="#id/yt_btn"
app:layout_constraintEnd_toStartOf="#id/insta_btn"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.25"
tools:layout_editor_absoluteY="40dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/twtrlogo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#drawable/ic_circle_white">
<ImageView
android:layout_width="18dp"
android:layout_height="14dp"
android:layout_centerInParent="true"
android:src="#drawable/twitter_logo" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins_medium"
android:paddingTop="9dp"
android:text="Twitter"
android:textSize="12.3dp" />
</LinearLayout>
</LinearLayout>
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 am not able to find out the exact issue that why the image(background) is not visible in API level 16 but it is showing good in API level 19. I have worked simply as i have done previously but , this time the background is not shown(of WaterMark in ImageView).
I am not able to find out what is exact issue . So i need help.I have done every thing as suggested in the stack Android device is not showing the background image but it is not going good in my case.
xml
<?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"
android:orientation="vertical">
<ScrollView
android:id="#+id/scrollLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/rlGetInTouch"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<RelativeLayout
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/header_bg2">
<ImageView
android:id="#+id/brand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/nbl_logo4" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:layout_marginTop="-60dp"
android:color="#android:color/transparent"
android:src="#drawable/logowatermark" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/edit_text_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="35dp"
android:paddingRight="35dp">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text=" Please login to proceed"
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<******.CustomFontEditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Mobile Number"
android:inputType="number"
android:maxLength="#integer/mobile_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontEditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:layout_toLeftOf="#+id/passwordVisibilityBtn"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Password"
android:inputType="textPassword"
android:maxLength="#integer/password_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontCheckBox
android:id="#+id/chkSaveUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:button="#drawable/custom_checkbox"
android:drawablePadding="5dp"
android:gravity="center"
android:text=" Remember Mobile No."
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<LinearLayout
android:id="#+id/loginLl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/login_button_shadow"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:id="#+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:padding="13dp"
android:text="Login"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="14sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_sms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:text="Switch To SMS"
android:textColor="#color/white"
android:textSize="12sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<******.CustomFontLoginTextView
android:id="#+id/resetDeviceId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_reset_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/reset_device_id_text"
android:textColor="#color/white"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_info_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/info"
android:textColor="#color/white"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- Promo -->
<LinearLayout
android:id="#+id/llPromotions"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/promo_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llBranches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlLogin"
android:layout_gravity="center"
android:background="#304EA2"
android:gravity="center"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showATMs"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:padding="2dp"
android:src="#drawable/icon_atm_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="ATM"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest Atm Machines"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showBranches"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_branches_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="8dp"
android:text="BRANCHES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest bank branches"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:onClick="showRates"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_rates_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="RATES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Foreign exchange and stock rates"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/rlProducts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Products"
android:textAllCaps="true"
android:textColor="#color/gray"
android:textSize="14sp" />
<!--Product Container-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--Product 1-->
<LinearLayout
android:id="#+id/product_content1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="7.5dp"
android:layout_weight="1"
android:orientation="vertical" />
<!--Product 2-->
<LinearLayout
android:id="#+id/product_content2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="7.5dp"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:gravity="end"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/rlGetInTouch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#304EA2"
android:orientation="horizontal">
<CustomFontLoginTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/btnCall"
android:paddingLeft="15dp"
android:singleLine="true"
android:text="Get in touch with us"
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="normal" />
<!--app:maxTextSize="14sp"
app:minTextSize="#dimen/minFontSize"-->
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnMap"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:onClick="showLocation"
android:src="#drawable/ic_action_location_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnEmail"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnMap"
android:layout_toStartOf="#+id/btnMap"
android:onClick="openEmail"
android:src="#drawable/ic_action_mail_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnCall"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnEmail"
android:layout_toStartOf="#+id/btnEmail"
android:onClick="openCall"
android:src="#drawable/ic_action_call_24_4" />
</RelativeLayout>
</RelativeLayout>
The Image background of watermark is not shown. I have done nothing
new ,same as previous but dont' know that is the exact issue.
Please reduce image size to visible in the lower level device.
I Just Removed marginTop and it worked fine in API level 16
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:src="#drawable/logowatermark" />
I don't understand that why it worked when i remove the -ve marginTop
in above? .I got solution but don't understand what exactly happened
in adding -ve marginTop and with removing -ve marginTop.
i was working in android studio with any problem, but suddenly after opening "lint warning in layout" after click on its suggest Gradle synced and all my layout has been change in output APK but all layout in android studio has not any problem .please see my attached image .
why this problem occurred ?
this is my xml code :
<android.support.constraint.ConstraintLayout 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="fragments.AboutHimmelFragment"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">
<!-- TODO: Update blank fragment layout -->
<ImageView
android:id="#+id/imageView9"
android:layout_width="0dp"
android:layout_height="167dp"
android:scaleType="fitXY"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/headerabout" />
<LinearLayout
android:id="#+id/lin_telegramchannel"
android:layout_width="70dp"
android:layout_alignParentBottom="true"
android:layout_height="70dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="129dp"
android:background="#drawable/circle"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal"
app:layout_constraintHorizontal_bias="0.076"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp">
<ImageView
android:id="#+id/imageView10"
android:layout_width="35dp"
android:layout_height="35dp"
app:srcCompat="#drawable/icontelegram" />
</LinearLayout>
<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView9">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/txt_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="درباره هیمل"
android:textColor="#color/title"
android:textSize="24sp" />
<LinearLayout
android:id="#+id/ln_Call1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#color/BackGeneralGreen"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/textView66"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="09122831879"
android:textColor="#color/WhiteColor"
android:textSize="20sp" />
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="9dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="9dp"
android:background="#color/WhiteColor"
android:orientation="horizontal"></LinearLayout>
<ImageView
android:id="#+id/imageView133"
android:layout_width="26dp"
android:layout_height="24dp"
app:srcCompat="#drawable/iconphone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#color/BackGeneralGreen"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/textView666"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="021-55741239"
android:textColor="#color/WhiteColor"
android:textSize="20sp" />
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="9dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="9dp"
android:background="#color/WhiteColor"
android:orientation="horizontal"></LinearLayout>
<ImageView
android:id="#+id/imageView1333"
android:layout_width="26dp"
android:layout_height="24dp"
app:srcCompat="#drawable/iconphone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#color/BackGeneralGreen"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/textView65"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="09101596788"
android:textColor="#color/WhiteColor"
android:textSize="20sp" />
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="9dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="9dp"
android:background="#color/WhiteColor"
android:orientation="horizontal"></LinearLayout>
<ImageView
android:id="#+id/imageView13"
android:layout_width="26dp"
android:layout_height="24dp"
app:srcCompat="#drawable/iconphone" />
</LinearLayout>
<LinearLayout
android:id="#+id/Ln_SendMail"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#color/BackGeneralGreen"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="info#himmel.com"
android:textColor="#color/WhiteColor"
android:textSize="20sp" />
<LinearLayout
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="9dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="9dp"
android:background="#color/WhiteColor"
android:orientation="horizontal"></LinearLayout>
<ImageView
android:id="#+id/imageView132"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#android:drawable/sym_action_email" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="467dp">
<ImageView
android:id="#+id/imageView14"
android:layout_width="39dp"
android:layout_height="29dp"
android:layout_marginTop="20dp"
app:srcCompat="#drawable/iconabout" />
<TextView
android:id="#+id/txt_Content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:gravity="top|right"
android:lineSpacingExtra="14sp"
android:text="#string/AboutHimmel"
android:textSize="18sp" />
</LinearLayout>
i clean and remove apk in emulator more than 3 times but never thing has not been changed ! any one can help me ?
I found reason ! this happened because of list line :
<ScrollView
android:layout_width="0dp"
android:layout_height="0dp"
when i change 0dp to match-parent its work fine. but yet i dont know why this doesn't show in preview !
Try, go to Files>Invalidate Cache/Restart
i'm trynig to support diffrent screen and i have a problem with normal size ( 4.0" 480*800 hdpi ) Everything shows big See picture :
enter image description here
(5.2" 1080*1920) See picture :
enter image description here
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#2b2b2b"
android:orientation="vertical"
tools:context="maa.ramplusplus.MainActivity">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
android:src="#mipmap/info"
android:id="#+id/infoid"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
android:src="#mipmap/share"
android:id="#+id/Sharebtn"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" />
<FrameLayout
android:id="#+id/frame"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_centerHorizontal="true"
>
<TextView
android:id="#+id/tvPercent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="80 %"
android:layout_marginBottom="10dp"
android:textColor="#FFF"
android:textSize="50sp" />
<TextView
android:layout_marginTop="40dp"
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Used RAM"
android:textStyle="bold"
android:textColor="#FFF"
android:textSize="28sp" />
<com.timqi.sectorprogressview.ColorfulRingProgressView
android:id="#+id/crpv"
android:layout_width="254dp"
android:layout_height="254dp"
app:bgColor="#d4ffffff"
app:fgColorEnd="#ff1e22"
app:fgColorStart="#61429f"
app:percent="80"
android:layout_gravity="center"
app:startAngle="0"
app:strokeWidth="21dp" />
</FrameLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Inmprove Your Device's Performance And Make It Faster"
android:textColor="#color/white"
android:textSize="14sp"
android:textStyle="bold"
android:id="#+id/textView"
android:layout_below="#+id/frame"
android:layout_alignLeft="#+id/Sharebtn"
android:layout_alignStart="#+id/Sharebtn" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:id="#+id/linearLayout3"
android:layout_marginTop="11dp"
android:layout_below="#+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<View
android:layout_height="1dp"
android:layout_width="150dp"
android:background="#FFF"
android:layout_gravity="center"/>
<TextView
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="O"
android:textSize="20sp"
android:textColor="#e2d81a"
android:textStyle="bold"
android:layout_gravity="center"/>
<View
android:layout_height="1dp"
android:layout_width="150dp"
android:background="#FFF"
android:layout_gravity="center" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Total"
android:textColor="#color/white"
android:textSize="14sp"
android:textStyle="bold"
android:id="#+id/Total"
android:layout_below="#+id/linearLayout3"
android:layout_alignLeft="#+id/textView"
android:layout_alignStart="#+id/textView" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Free"
android:textSize="14sp"
android:textColor="#color/white"
android:textStyle="bold"
android:id="#+id/Free"
android:layout_marginTop="12dp"
android:layout_below="#+id/Total"
android:layout_alignLeft="#+id/Total"
android:layout_alignStart="#+id/Total" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:id="#+id/linearLayout4"
android:layout_marginTop="8dp"
android:layout_below="#+id/Free"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<View
android:layout_height="1dp"
android:layout_width="150dp"
android:background="#FFF"
android:layout_gravity="center"/>
<TextView
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="O"
android:textSize="20sp"
android:textColor="#e2d81a"
android:textStyle="bold"
android:layout_gravity="center"/>
<View
android:layout_height="1dp"
android:layout_width="150dp"
android:background="#FFF"
android:layout_gravity="center" />
</LinearLayout>
Use this for adjusting image size
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="10">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#null"
android:src="#drawable/facebook"
android:id="#+id/infoid"
android:scaleType="fitCenter"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="7.6"></LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
android:src="#drawable/google_plus"
android:id="#+id/Sharebtn"
android:scaleType="fitCenter"/>
</LinearLayout>
</LinearLayout>
adjust weight and weightsum as required.