I'm working on a chat app where users can send Texts/Images to another user. so if the sender is the current user then the messages(text/Image) will appear on the right of the page. and if the current user is the receiver then messages appear on left. Like this:
I want to add progressBar on the centre of the image on both sides. (for loading image purposes).
Here is the XML of the right-side:
<RelativeLayout
android:layout_width="#dimen/_280sdp"
android:layout_alignParentEnd="true"
android:layout_height="wrap_content">
<com.makeramen.roundedimageview.RoundedImageView
android:id="#+id/imageIV"
android:layout_width="200dp"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:layout_alignParentEnd="true"
android:adjustViewBounds="true"
app:riv_corner_radius="15dp"
android:layout_below="#+id/date"
android:src="#drawable/ic_baseline_image_24"
/>
<ProgressBar
android:visibility="gone"
android:id="#+id/pb"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignStart="#+id/imageIV"
android:layout_alignBottom="#+id/imageIV"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="85dp"
android:layout_marginTop="85dp"
android:layout_marginEnd="85dp"
android:layout_marginBottom="85dp" />
<LinearLayout
android:orientation="vertical"
android:id="#+id/message_wrapper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageIV"
android:padding="#dimen/_5sdp"
android:layout_alignParentEnd="true"
android:background="#drawable/background_right"
android:layout_marginTop="10dip">
<TextView
android:id="#+id/show_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello"
android:visibility="gone"
android:textSize="18sp"
android:textColor="#fff"
android:paddingLeft="5dp"
android:paddingRight="5dp"/>
<TextView
android:id="#+id/messageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="time"
android:textColor="#fff"
android:textSize="10dp" />
</LinearLayout>
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="date"
android:layout_alignParentEnd="true"
android:textColor="#AEAEAE"
android:paddingEnd="#dimen/_5sdp"
android:textSize="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txt_seen"
android:paddingTop="#dimen/_5sdp"
android:layout_below="#+id/message_wrapper"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
/>
</RelativeLayout>
and Here is the XML of the Left-side:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="#dimen/_280sdp"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="5dp"
android:id="#+id/messageLayout"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="#dimen/_3sdp"
android:src="#drawable/pl"/>
<com.makeramen.roundedimageview.RoundedImageView
android:id="#+id/imageIV"
android:layout_width="200dp"
android:layout_height="200dp"
android:scaleType="centerCrop"
android:layout_toEndOf="#+id/profile_image"
android:adjustViewBounds="true"
app:riv_corner_radius="15dp"
android:layout_below="#+id/date"
android:src="#drawable/ic_baseline_image_24"
/>
<ProgressBar
android:id="#+id/pb"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignStart="#+id/imageIV"
android:layout_alignBottom="#+id/imageIV"
android:layout_marginStart="85dp"
android:layout_marginTop="85dp"
android:layout_marginEnd="85dp"
android:layout_marginBottom="85dp" />
<LinearLayout
android:id="#+id/message_wrapper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/_5sdp"
android:layout_below="#+id/imageIV"
android:layout_toEndOf="#id/profile_image"
android:background="#drawable/background_left"
android:layout_marginTop="10dip">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/show_message"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="18sp"
android:text="Hello"
android:paddingLeft="5dp"
android:paddingRight="5dp"
/>
<TextView
android:id="#+id/messageTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="time"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textSize="8dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="date"
android:layout_toRightOf="#+id/profile_image"
android:textColor="#AEAEAE"
android:paddingRight="#dimen/_5sdp"
android:textSize="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txt_seen"
android:paddingTop="#dimen/_5sdp"
android:visibility="gone"
android:layout_below="#+id/message_wrapper"
/>
</RelativeLayout>
How can I do this? please help.
You can add extra progress layout_alignEnd/layout_alignTop attributes for right layout:
<ProgressBar
android:id="#+id/pb"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignStart="#+id/imageIV"
android:layout_alignBottom="#+id/imageIV"
android:layout_alignEnd="#+id/imageIV"
android:layout_alignTop="#+id/imageIV" />
and layout_alignTop/layout_alignEnd for the left layout:
<ProgressBar
android:id="#+id/pb"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignStart="#+id/imageIV"
android:layout_alignBottom="#+id/imageIV"
android:layout_alignTop="#+id/imageIV"
android:layout_alignEnd="#+id/imageIV"
/>
Related
I have bellow layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".activities.completion_information_activity.CompletionInformationActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBarCompletionInformation"
android:layout_width="match_parent"
android:layout_height="240dp"
android:theme="#style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="#+id/toolbarLayoutCompletionInformation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="60dp"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="#+id/toolbarCompletionInformation">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbarCompletionInformation"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:contentInsetStart="0dp"
android:contentInsetLeft="0dp"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay"
app:title="SSADSDWQEWQ">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<ImageButton
android:id="#+id/imgBackCompletionInformation"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:background="#null"
android:src="#drawable/ic_baseline_arrow_back_24"
app:tint="#color/black" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
<RelativeLayout
android:id="#+id/relativeLayoutCompletionInformation"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:background="#drawable/border">
<ImageView
android:id="#+id/imgProfileCompletionInformation"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:padding="3dp"
android:scaleType="fitXY" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imgProfileCompletionInformation"
android:layout_alignParentRight="true"
android:src="#drawable/ic_baseline_photo_camera_24" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayoutToFadeOutCompletionInformation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_collapseMode="parallax">
<TextView
android:id="#+id/txtProfileNameCompletionInformation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Name"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/bright_gray"
android:fitsSystemWindows="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="...CompletionInformationActivity"
tools:showIn="#layout/activity_completion_information">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/one"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="#drawable/custom_cardview_bottom_top_shadow"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/edtUserNameEdit"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:background="#drawable/text_input_layout_stroke_color"
android:hint="User Name"
android:inputType="text"
android:isScrollContainer="true"
android:maxLines="1"
android:padding="5dp"
android:scrollHorizontally="true" />
<TextView
android:id="#+id/txtNameEditCompletion"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignRight="#+id/edtUserNameEdit"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:text="User Name"
android:textColor="#color/black"
android:textStyle="bold" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Problem:
When extend AppCompatEditText it overlap on TextView.
I need that AppCompatEditText be android:layout_width="wrap_content". And when user type extend AppCompatEditText to left TextView.
Replace your xml to this one :
I have made some changes as your requirements :
I have changed your RelativeLayout to the LinearLayout and made orientation horizontal with 1 weight of AppCompactTextView
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBarCompletionInformation"
android:layout_width="match_parent"
android:layout_height="240dp"
android:theme="#style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="#+id/toolbarLayoutCompletionInformation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="60dp"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="#+id/toolbarCompletionInformation">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbarCompletionInformation"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:contentInsetStart="0dp"
android:contentInsetLeft="0dp"
android:contentInsetEnd="0dp"
android:contentInsetRight="0dp"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay"
app:title="SSADSDWQEWQ">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<ImageButton
android:id="#+id/imgBackCompletionInformation"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:background="#null"
android:src="#drawable/ic_baseline_arrow_back_24"
app:tint="#color/black" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
<RelativeLayout
android:id="#+id/relativeLayoutCompletionInformation"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:background="#drawable/border">
<ImageView
android:id="#+id/imgProfileCompletionInformation"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:padding="3dp"
android:scaleType="fitXY" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imgProfileCompletionInformation"
android:layout_alignParentRight="true"
android:src="#drawable/ic_baseline_photo_camera_24" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayoutToFadeOutCompletionInformation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:layout_collapseMode="parallax">
<TextView
android:id="#+id/txtProfileNameCompletionInformation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Name"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/bright_gray"
android:fitsSystemWindows="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="...CompletionInformationActivity"
tools:showIn="#layout/activity_completion_information">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/one"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="#drawable/custom_cardview_bottom_top_shadow"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="MissingConstraints">
<RelativeLayout
android:layout_toStartOf="#+id/txtNameEditCompletion"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatEditText
android:id="#+id/edtUserNameEdit"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_alignParentStart="true"
android:background="#drawable/text_input_layout_stroke_color"
android:hint="User Name"
android:inputType="text"
android:isScrollContainer="true"
android:maxLines="1"
android:padding="5dp"
android:scrollHorizontally="true" />
</RelativeLayout>
<TextView
android:layout_alignParentEnd="true"
android:id="#+id/txtNameEditCompletion"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:gravity="center_vertical"
android:text="User Name"
android:textColor="#color/black"
android:textStyle="bold" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteY="25dp">
<TableLayout
android:id="#+id/tableLayoutHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textViewDeviceName">
</TableLayout>
<ScrollView
android:id="#+id/scrollViewLayoutFoo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:minWidth="150dp"
android:minHeight="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tableLayoutHeader">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/red"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linearLayoutFragments1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" />
<LinearLayout
android:id="#+id/linearLayoutFragments2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"></LinearLayout>
</LinearLayout>
</ScrollView>
</android.support.constraint.ConstraintLayout>
linearLayoutFragments1 and linearLayoutFragments2 have many fragments added at runtime. Unfortunately, scrollViewLayoutFoo is not constrained below tableLayoutHeader, but overflows into tableLayoutHeader.
Could anyone offer a tip on how to fix this?
You were missing some constraints.
You need to constraint the TabLayout to the parent from start/top/end and scroll view constraint to the bottom of it.
There are also referenced some views that are not in the example so you might have to update them accordingly.
<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">
<TableLayout
android:id="#+id/tableLayoutHeader"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_height="48dp" />
<ScrollView
android:id="#+id/scrollViewLayoutFoo"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:minHeight="60dp"
android:minWidth="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tableLayoutHeader">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linearLayoutFragments1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
<LinearLayout
android:id="#+id/linearLayoutFragments2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
</ScrollView>
</android.support.constraint.ConstraintLayout>
I have created a payment info screen but would like to adjust it to make it look more like the image below. I have added below my attempted code. How do I go about doing this? Any help would be greatly appreciated. I would like to know how to split the layout into 3 sections and have buttons like the image. Also how would I align my text to be under each other?
Image of what I would like to achieve
Code Below
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:background="#color/colorPrimary"
android:layout_gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<ImageView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/solver"/>
<View
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Record phone calls"
android:textColor="#color/colorWhite"
android:layout_gravity="center"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Know who viewed your profile"
android:textColor="#color/colorWhite"
android:layout_gravity="center"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Option to view profiles privately"
android:textColor="#color/colorWhite"
android:layout_gravity="center"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Get the Premium badge on your profile"
android:textColor="#color/colorWhite"
android:layout_gravity="center"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30 contact requests a month"
android:layout_gravity="center"
android:textColor="#color/colorWhite"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No ads"
android:layout_gravity="center"
android:textColor="#color/colorWhite"
android:textSize="18sp"/>
</LinearLayout>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Monthly Premium R19,19"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yearly Premium R179,99"/>
</LinearLayout>
</ScrollView>
Don't use scrollView. Use a vertical LinearLayout and give it's children suitable weights
Something Like this:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="vertical">
<ImageView android:layout_width="match_parent"
android:layout_height="match_parent"
android:weight="1.25">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:weight="1"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
And for transparensy use this style for your activity in manifest
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#66000000</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowFullscreen">true</item>
</style>
I have this code where I always get an error about a mismatched tag, I cant see the error myself, can someone help me? thanks a million.
And I also get this error: Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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=".DetailsSongs">
<android.support.design.widget.AppBarLayout
android:layout_widht="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="FFECB3"
android:padding="16dp"
android:text="#string/songdetailsdescription" />
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientaion="vertical"
android:weightSum="1"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<Linearlayout
android:layout_width="match_parent"
android:layouth_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layouth_height="match_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/image_placeholder_dark_large"
android:contentDescription="#string/songdetailscontentdescriptionalbumart"
android:scaleType="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:paddingTop="16dp"
android:text="#string/songnameplaceholder"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:paddingTop="4dp"
android:text="#string/songauthorplaceholder"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="#drawable/media_controls_play_dark_small"
android:gravity="center"
android:paddingBottom="2dp"
android:paddingBtottom="2dp"
android:text="#string/songdetailsplaynow" />
This is where is says that there is an error (LinearLayout) below this comment
</Linearlayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/songdetailssimilarsongs"
android:textSize="18sp" />
<HorizontalScrollView
android:id="#+id/related_albums"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp" >
<include layout="#layout/relatedsongslist" />
</HorizontalScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:text="#string/songdescriptionplaceholder" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1">
<include layout="#layout/player" />
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
almost all your tags are mismatched and its causing the problem, i dont know what you trying but i think your best bet will be to try and restart the design again
but this is what i could help. rewrote your xml.
<android.support.design.widget.CoordinatorLayout 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=".DetailsSongs">
<android.support.design.widget.AppBarLayout
android:layout_widht="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="FFECB3"
android:padding="16dp"
android:text="#string/songdetailsdescription" />
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientaion="vertical"
android:weightSum="1"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<Linearlayout
android:layout_width="match_parent"
android:layouth_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layouth_height="match_content"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/image_placeholder_dark_large"
android:contentDescription="#string/songdetailscontentdescriptionalbumart"
android:scaleType="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:paddingTop="16dp"
android:text="#string/songnameplaceholder"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:paddingTop="4dp"
android:text="#string/songauthorplaceholder"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="#drawable/media_controls_play_dark_small"
android:gravity="center"
android:paddingBottom="2dp"
android:paddingBtottom="2dp"
android:text="#string/songdetailsplaynow" />
</LinearLayout>
</Linearlayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/songdetailssimilarsongs"
android:textSize="18sp" />
<HorizontalScrollView
android:id="#+id/related_albums"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp" >
<include layout="#layout/relatedsongslist" />
</HorizontalScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:text="#string/songdescriptionplaceholder" />
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1">
<include layout="#layout/player" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Try this out and hopefully could help you
I want create custom ui notification and show it full screen. How can I do it.
<LinearLayout>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="#+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="#drawable/icon_image" />
<TextView
android:id="#+id/alarm_text"
style="#style/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:text="#string/in_progress" />
<RelativeLayout
android:id="#+id/sticky_header"
android:layout_width="match_parent"
android:layout_height="#dimen/eader_height"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<TextView
android:id="#+id/sticky_text"
style="#style/normal_white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="#string/message" />
<TextView
android:id="#+id/button"
style="#style/white"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="#drawable/msg_selector"
android:gravity="center"
android:text="#string/msg" />
</RelativeLayout>
</LinearLayout>
I know there are RemoteViews we could use, but I am not sure how to set it up to NotificationCompat.Builder
Also I need to take action(launch activity) when the user presses the button in id -> button