In my Android app, I am trying to get the birthday of the user. Below is my XML document .
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/colorPurple"
app:popupTheme="#style/AppTheme.PopupOverlay"
style="#style/MyDrawerArrowToggle"
android:layout_marginTop="#dimen/toolbar_layout_top_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="30dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="#+id/signUp_back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/back_arrow_white" />
</LinearLayout>
<LinearLayout
android:layout_width="220dp"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="20dp"
android:text="#string/birthday"
android:textColor="#color/colorWhite"
android:gravity="center|left"
android:paddingLeft="20dp"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="18dp"
android:textStyle="bold"
android:text="#string/what_is_your_birthday"
android:gravity="center"
android:layout_marginTop="60dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="30dp">
<DatePicker
android:layout_width="match_parent"
android:layout_height="150dp"
android:datePickerMode="spinner"
android:id="#+id/date_picker"/>
<!--<com.aigestudio.wheelpicker.widgets.WheelDayPicker-->
<!--android:layout_width="50dp"-->
<!--android:layout_height="match_parent" />-->
<!--<com.aigestudio.wheelpicker.widgets.WheelMonthPicker-->
<!--android:layout_width="50dp"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_marginLeft="20dp"/>-->
<!--<com.aigestudio.wheelpicker.widgets.WheelYearPicker-->
<!--android:layout_width="50dp"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_marginLeft="20dp"/>-->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#color/colorPurple"
android:layout_marginTop="40dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="#+id/signup_birthday_next_button_layout">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text = "#string/next_text"
android:textColor="#color/colorWhite"
android:textSize="14dp"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
This gives me the below UI
But I am looking for the below
How can I get the second UI?
Please add this xml file it may be help full to solve your problem.
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:gravity="center"
android:id="#+id/btnNotification"
android:text="What is your birthday"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<DatePicker
android:id="#+id/spinnerDatePicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:calendarViewShown="false"
android:datePickerMode="spinner"
android:descendantFocusability="blocksDescendants"
android:focusable="true"
android:spinnersShown="true" />
<Button
android:text="next"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
You can use SpinnerDatePicker open source library it has UI like below
As it is open source you can change if you need.
Related
I'm using the FlowingDrawer library
But there is a problem
When running, FlowingDrawer covers the entire mobile launcher and no options can be selected.
This means that when the program is running, I can not select an option and it is as if a page covers the entire content (like when a transparent is used as a background)
FlowingDrawer runs but the whole page crashes and no option can be selected
What way do you suggest to solve this problem ?!
I hope I have clarified what I mean
Grateful
enter image description here
<com.mxn.soul.flowingdrawer_core.FlowingDrawer
android:id="#+id/drawerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:fitsSystemWindows="true"
app:edPosition="1"
app:edMenuSize="260dp"
app:edMenuBackground="#dddddd">
<!--content-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="#+id/fl_main"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<!--menu-->
<com.mxn.soul.flowingdrawer_core.FlowingMenuLayout
android:id="#+id/menulayout"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/id_container_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="#+id/header">
<ImageView
android:id="#+id/imgChannelCoverDrawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/bg_card_video_main"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#color/colorPrimary">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/CircleImageChannelProfileDrawer"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginTop="50dp"
android:src="#drawable/image_placeholder"
app:civ_border_color="#color/colorPrimary"
app:layout_anchor="#id/mainAppBar"
app:layout_anchorGravity="center_vertical|center_horizontal"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="انیمیشن بی مغز"
android:textSize="28sp"
android:fontFamily="#font/yekan"
android:textColor="#color/cardview_dark_background"
android:gravity="center_horizontal|center_vertical"/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/li_home"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/header"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/home_24"
android:padding="4dp"
app:tint="#color/cardview_dark_background"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="صفحه اصلی"
android:textColor="#color/cardview_dark_background"
android:fontFamily="#font/yekan"
android:textSize="16sp"
android:padding="4dp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/li_share"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/li_home"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/share_24"
android:padding="4dp"
app:tint="#color/cardview_dark_background" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="اشتراک گذاری"
android:textColor="#color/cardview_dark_background"
android:fontFamily="#font/yekan"
android:textSize="16sp"
android:padding="4dp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/li_about"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/li_share"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/person_outline_24"
android:padding="4dp"
app:tint="#color/cardview_dark_background" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="درباره ما"
android:textColor="#color/cardview_dark_background"
android:fontFamily="#font/yekan"
android:textSize="16sp"
android:padding="4dp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/li_logout"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layoutDirection="rtl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/li_about"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="24dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_baseline_power_settings_new_24"
android:padding="4dp"
app:tint="#color/cardview_dark_background" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="خروج از برنامه"
android:textColor="#color/cardview_dark_background"
android:fontFamily="#font/yekan"
android:textSize="16sp"
android:padding="4dp"/>
</LinearLayout>
</RelativeLayout>
</com.mxn.soul.flowingdrawer_core.FlowingMenuLayout>
</com.mxn.soul.flowingdrawer_core.FlowingDrawer>
no matter what I do in my design, I want to center what I wrote with the photographs, but I cannot do the design, I wonder where I am going wrong I'm learning new and tried to make a design like in the photo
I'll create the rest using the recycler view and card view
Enough explanation, I hope I don't want to confuse you
<androidx.cardview.widget.CardView 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">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView6"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="TODO" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="text" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Date" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView7"
android:layout_width="60dp"
android:layout_height="60dp"" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
Splitted the center part to two linear layouts. Also added android:gravity="center|bottom" to the TextView which contains the date.
<androidx.cardview.widget.CardView 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">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView6"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="TODO" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="text" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="text" />
</LinearLayout>
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|bottom"
android:text="Date" />
</LinearLayout>
<ImageView
android:id="#+id/imageView7"
android:layout_width="60dp"
android:layout_height="60dp" />
</LinearLayout> </androidx.cardview.widget.CardView>
Here's how it looks like. I added some colors so it's easier to see where layouts begin and end. The colors are not part of the xml.
I want the screen to automatically scroll up when the keyboard opens, so that the user can see what he has written.
The solution I found was to change the manifest and use adjustPan or adjustResize. I used both of them but it still didn't work.
Where is my mistake?
Thanks in advance.
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:background="#color/white"
tools:context=".auth.LoginActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
android:src="#mipmap/img_login"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
tools:ignore="MissingConstraints" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-100dp"
android:orientation="vertical"
android:background="#drawable/login_back">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:textColor="#color/customColor"
android:gravity="center"
android:textSize="30dp"
android:layout_marginTop="42dp"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:focusableInTouchMode="true"
android:hint="User Name"
android:layoutDirection="rtl"
android:textColorHint="#color/customColor"
>
<EditText
android:id="#+id/acLogin_edtUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="ltr"
android:inputType="textEmailAddress"
android:textSize="16dp"
android:singleLine="true"
android:textColor="#color/customColor"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:focusableInTouchMode="true"
android:hint="Password"
android:layoutDirection="rtl"
android:textColorHint="#color/customColor"
>
<EditText
android:id="#+id/acLogin_edtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textSize="16dp"
android:textColor="#color/customColor"
/>
</com.google.android.material.textfield.TextInputLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="42dp"
android:layout_gravity="center"
android:layout_marginRight="50dp"
android:layout_marginLeft="50dp"
android:clickable="true"
android:focusable="true"
app:cardBackgroundColor="#color/customColor"
app:cardCornerRadius="8dp">
<TextView
android:id="#+id/acLogin_txtLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Login"
android:textColor="#ffffff"
android:textSize="18dp" />
<ProgressBar
android:id="#+id/acLogin_prgLoading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:visibility="gone" />
</androidx.cardview.widget.CardView>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="48dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Don't have any account?"
android:gravity="bottom"
android:layout_marginLeft="58dp"
android:textColor="#color/customColor"
android:textSize="16dp"/>
<TextView
android:id="#+id/acLogin_txtSignUp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:gravity="bottom"
android:text="Sign Up"
android:textColor="#color/customColor"
android:textSize="16dp" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="200dp"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I change manifest to:
<activity android:name=".auth.LoginActivity"
android:windowSoftInputMode="adjustPan | adjustResize"/>
I am facing issue in android xml. I get error like above but as per my I have not given Circular dependencies in my xml. I am trying from last 1 hour for fix it but I am not able to complete it. I have used above and below as per requirement. I am attaching my xml here. Let me know if someone can point me where I am wrong. My XML is like below
<?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="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fab="http://schemas.android.com/apk/res-auto"
tools:context="com.karopass.karoshare.ImageDetails">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_imageDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:theme="#style/AppTheme.AppBarOverlay"
app:popupTheme="#style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<com.example.utils.ExtendedViewPager
android:id="#+id/view_pager_extended"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/pageNavCount"
android:layout_below="#+id/toolbar_imageDetails"
android:background="#color/image_back"/>
<LinearLayout
android:background="#color/colorPrimary"
android:id="#+id/pageNavCount"
android:orientation="horizontal"
android:layout_above="#+id/devider"
android:layout_width="match_parent"
android:layout_height="20dp">
<RelativeLayout
android:layout_weight="3"
android:id="#+id/new_time_count"
style="#style/SelectableItemBackground"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:id="#+id/txt_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1 Month ago"
android:textSize="12sp"
android:paddingLeft="5sp"
android:layout_centerVertical="true"
android:textColor="#cccccc"
android:gravity="center|start" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:id="#+id/new_share_count"
style="#style/SelectableItemBackground"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:id="#+id/share_count"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="999"
android:textSize="12sp"
android:paddingLeft="5sp"
android:layout_centerVertical="true"
android:textColor="#cccccc"
android:gravity="center|start" />
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
style="#style/SelectableItemBackground"
android:id="#+id/new_save_count"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:id="#+id/like_count"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="999"
android:textSize="12sp"
android:paddingLeft="5sp"
android:layout_centerVertical="true"
android:textColor="#cccccc"
android:gravity="center|start" />
</RelativeLayout>
</LinearLayout>
<View
android:id="#+id/devider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="#+id/pageNavLayout"
android:background="#ffffff" />
<LinearLayout
android:background="#color/colorPrimary"
android:id="#+id/pageNavLayout"
android:orientation="horizontal"
android:layout_above="#+id/ll_adLayout_latest"
android:layout_width="match_parent"
android:layout_height="48dp">
<RelativeLayout
android:layout_weight="1"
android:id="#+id/new_time"
style="#style/SelectableItemBackground"
android:clickable="true"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:scaleType="fitCenter"
android:src="#mipmap/ic_past_961"
android:layout_width="#dimen/nav_but_size"
android:layout_height="#dimen/nav_but_size" />
</RelativeLayout>-->
<TextView
android:background="#ffffff"
android:layout_width="1dp"
android:layout_height="match_parent" />
<RelativeLayout
android:id="#+id/new_copy"
android:clickable="true"
style="#style/SelectableItemBackground"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:src="#mipmap/ic_copy_96"
android:layout_width="#dimen/nav_but_size"
android:layout_height="#dimen/nav_but_size" />
</RelativeLayout>
<TextView
android:background="#ffffff"
android:layout_width="1dp"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_weight="1"
android:id="#+id/new_save"
style="#style/SelectableItemBackground"
android:clickable="true"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:src="#mipmap/ic_save_96"
android:layout_width="#dimen/nav_but_size"
android:layout_height="#dimen/nav_but_size" />
</RelativeLayout>
<TextView
android:background="#ffffff"
android:layout_width="1dp"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_weight="1"
android:id="#+id/new_share"
style="#style/SelectableItemBackground"
android:clickable="true"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:src="#mipmap/ic_share_96"
android:layout_width="#dimen/nav_but_size"
android:layout_height="#dimen/nav_but_size" />
</RelativeLayout>
<TextView
android:background="#ffffff"
android:layout_width="1dp"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_weight="1"
style="#style/SelectableItemBackground"
android:clickable="true"
android:id="#+id/new_fav"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageView
android:layout_centerInParent="true"
android:src="#mipmap/ic_hearts_96"
android:layout_width="#dimen/nav_but_size"
android:layout_height="#dimen/nav_but_size"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/ll_adLayout_latest"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>
Thanks a lot :)
You are using circular dependency here :
<LinearLayout
android:background="#color/colorPrimary"
android:id="#+id/pageNavCount"
android:orientation="horizontal"
android:layout_above="#+id/devider"
android:layout_width="match_parent"
android:layout_height="20dp">
and
<View
android:id="#+id/devider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="#+id/pageNavLayout"
android:background="#ffffff" />
you are putting layout_above and layout_below both to the extended view pager put only above or below and try it will solve let me know if its get solved
I am trying to build this layout
But I am getting this: (The map button in the location would be ideal height and width but the textview doesn't match the height)
My location is a TextView and my destination is a EditText
I want the TextView and EditText to be the same width while the MAP buttons stay "square".
How can I get the textviews height to match and make a square map button?
Here is my layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mycompany.controller.DetailsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/viewStatus"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvLocation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight=".8"
android:background="#color/COLOR_LIGHT_GREY"
android:text="123 MAIN ST., CHATTANOOGA TN 37404"
android:textSize="24sp"/>
<Button
android:id="#+id/btnMapLocation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutDestination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editDestination"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".8"
android:ems="10"
android:inputType="textMultiLine"
android:text="407 Broad St., Anywhere ST 00000"/>
<Button
android:id="#+id/btnMapDestination"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
I did a slight modification in your code check it!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/searchText"
android:text="Search text here"
android:layout_weight="0.8"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#c8c8c8"
/>
<Button
android:id="#+id/searchButton"
android:text="MAP"
android:layout_weight="0.2"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/searchText"
android:text="Search text"
android:layout_weight="0.8"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
<Button
android:id="#+id/searchButton"
android:text="MAP"
android:layout_weight="0.2"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Since you are using android:layout_weight, set android:layout_width="0dp"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mycompany.controller.DetailsFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/viewStatus"
android:layout_marginTop="5dp">
<LinearLayout
android:id="#+id/scrollViewDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- LOCATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="LOCATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/tvLocation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight=".8"
android:background="#color/COLOR_LIGHT_GREY"
android:text="123 MAIN ST., CHATTANOOGA TN 37404"
android:textSize="24sp"/>
<Button
android:id="#+id/btnMapLocation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
<!-- DESTINATION -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="DESTINATION"
android:textColor="#color/COLOR_BLUE"
android:textSize="24sp"/>
<LinearLayout
android:id="#+id/layoutDestination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editDestination"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:ems="10"
android:inputType="textMultiLine"
android:text="407 Broad St., Anywhere ST 00000"/>
<Button
android:id="#+id/btnMapDestination"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".2"
android:background="#color/COLOR_BLUE"
android:text="MAP"
android:textColor="#color/COLOR_WHITE"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>