I need delete a blue line that appears in my application when I compile with API 20 or higher but doesn't appear when I compile in API < 20.
This image shows the blue line I need delete.
that is mi code view XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginTop="0dp"
android:background="#color/transparent"
android:layout_height="280dp" >
<net.simonvt.numberpicker.NumberPicker
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
android:id="#+id/numberPicker1_popup"
android:singleLine="true"
android:background="#null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:configChanges="keyboard|keyboardHidden"
android:layout_centerVertical="true"
android:layout_alignLeft="#+id/title_picker"
android:layout_alignStart="#+id/title_picker"
android:layout_alignRight="#+id/title_picker"
android:layout_alignEnd="#+id/title_picker" />
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:text=""
android:id="#+id/button_cancel"
android:layout_below="#+id/numberPicker1"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_alignParentStart="false"
android:background="#drawable/big_cancel"/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/button_ok"
android:layout_alignTop="#+id/button_cancel"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="15dp"
android:background="#drawable/big_ok_line_green"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Title"
android:id="#+id/title_picker"
android:layout_marginTop="0dp"
android:layout_alignLeft="#+id/button_cancel"
android:layout_alignStart="#+id/button_cancel"
android:layout_alignRight="#+id/button_ok"
android:layout_alignEnd="#+id/button_ok"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="false"
android:textAlignment="center"
android:textColor="#000000"/>
</RelativeLayout>
and this is my style
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="numberPickerStyle">#style/NPWidget.Holo.Light.NumberPicker</item>
<item name="android:typeface">monospace</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.NowindowTitle">
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
thanks for helpme
You need to customize your view appearance by setting background , etc if you want to remove that blue line . Because that is the default appearance for that platform (which I guess is started since Honeycomb).
Related
I have some very short text input (like only 2 numeric characters) yet using the endIcon will hog half of my textview and will cut off and display ellipses. I cannot make the TextInputLayout wider so I how can I display the full 2 characters (or more) while using endIconDrawable?
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
android:layout_width="80dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_height="40dp"
android:background="#drawable/text_input_assessment"
app:boxStrokeWidth="0dp"
app:boxStrokeWidthFocused="0dp"
app:endIconDrawable="#drawable/ptx_down_arrow_android"
app:endIconTint="#color/colorPtxDarkBlue">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="#+id/dropdownDay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
android:fontFamily="#font/truenorg"
android:textSize="15sp"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="10sp"
app:autoSizeMaxTextSize="15sp"
app:autoSizeStepGranularity="1sp"
android:inputType="none"
android:maxLines="1"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:singleLine="true"
android:text="12"
android:textAlignment="viewStart"
android:textColor="#color/colorPtxDarkBlue"
tools:ignore="LabelFor" />
</com.google.android.material.textfield.TextInputLayout>
It is a workaround, not a final solution.
You can reduce the padding between the text and endIcon by adding a negative value in android:drawablePadding.
Something like:
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="#+id/dropdownDay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:drawablePadding="-12dp"
../>
A final note. You don't need to use android:background="#drawable/text_input_assessment" to have rounded corners. Just add app:shapeAppearanceOverlay="#style/ShapeAppearanceOverlay.Rounded" in the TextInputLayout with:
<style name="ShapeAppearanceOverlay.Rounded" parent="">
<item name="cornerSize">50%</item>
</style
You've defined a style for it already
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
So, the above line will add the dropdown icon automatically. I think you'll need to remove this line
app:endIconDrawable="#drawable/ptx_down_arrow_android"
Maybe the above line is overlapping the default icon
Then if you want to set tint to the drawable, just create a custom style
<style name="CustomAutoCompleteLayout" parent="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu">
<item name="endIconTint">#color/colorPtxDarkBlue</item>
</style>
And you add this two lines if you like
style="#style/CustomAutoCompleteLayout"
android:theme="#style/CustomAutoCompleteLayout"
Also i suggest that you remove this line and add it to the com.google.android.material.textfield.TextInputLayout instead.
android:paddingTop="10dp"
android:paddingBottom="10dp
Okay, i created this just now after 2hours and it worked very fine for me..
styles.xml
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="backgroundTint">#android:color/white</item>
<item name="colorPrimaryVariant">#color/colorPrimaryDark</item>
<item name="colorOnPrimary">#color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">#color/colorSecondary</item>
<item name="colorSecondaryVariant">#color/colorSecondaryVariant</item>
<item name="colorOnSecondary">#color/white</item>
<item name="android:textColor">#android:color/black</item>
<item name="button_textcolor">#android:color/black</item>
<item name="android:textColorPrimary">#android:color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
Don't worry about the constans e.g #color/colorPrimary. What matters is the parent theme.
Remember to use this below as your parent theme for AppTheme in android_manifest.xml since you've added style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu to <com.google.android.material.textfield.TextInputLayout else app crashes
parent="Theme.MaterialComponents.Light.NoActionBar">
Then add this to styles.xml also
<style name="AppTheme.MaterialTextInputExposed" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu">
<item name="hintTextColor">#color/colorSecondary</item>
<item name="boxStrokeColor">#color/colorSecondary</item>
<item name="boxStrokeErrorColor">#android:color/holo_red_dark</item>
<item name="errorTextColor">#android:color/holo_red_dark</item>
<item name="boxStrokeWidth">#dimen/_2dp</item>
<item name="boxCornerRadiusBottomEnd">#dimen/_6dp</item>
<item name="boxCornerRadiusBottomStart">#dimen/_6dp</item>
<item name="boxCornerRadiusTopStart">#dimen/_6dp</item>
<item name="boxCornerRadiusTopEnd">#dimen/_6dp</item>
<item name="colorControlActivated">#color/colorSecondary</item>
<item name="android:textColor">#android:color/black</item>
<item name="button_textcolor">#android:color/black</item>
<item name="endIconTint">#color/spinner</item>
</style>
You can now modify your activity_main.xml
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/choose_admission_mode"
style="#style/AppTheme.MaterialTextInputExposed"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_10dp"
android:theme="#style/AppTheme.MaterialTextInputExposed"
app:hintEnabled="true"
app:layout_constraintBottom_toTopOf="#id/choose_faculty"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/choose_program">
<AutoCompleteTextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:imeOptions="actionNext"
android:inputType="text"
android:textSize="#dimen/_18sp"
</com.google.android.material.textfield.TextInputLayout>
I Changed the below line but it's not necessary. You just need to be careful with the padding and remember #dimen/_6dp has value of 6dp and #dimen/_2dp has value of 2dp
<com.google.android.material.textfield.MaterialAutoCompleteTextView
to
<AutoCompleteTextView
When entering full screen immersive mode, there is a lighter portion where the navigation bar was
Here is my XML layout file:
<?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"
tools:context=".activities.QuoteActivity">
<TextView
android:id="#+id/quote"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:fontFamily="#font/din_light"
android:gravity="center_horizontal"
android:text=""Quote""
android:textColor="#FFFFFF"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/quote_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:fontFamily="#font/din_light"
android:gravity="center_horizontal"
android:text="- Author"
android:textColor="#FFFFFF"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/quote" />
</androidx.constraintlayout.widget.ConstraintLayout>
These are the flags I use to enter immersive mode :
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quote);
this.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN);
}
This is my styles.xml :
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowBackground">#drawable/bg_2880x1440</item>
</style>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:background">#drawable/ls_2880x1440</item>
</style>
</resources>
I am not using android:fitsSystemWindows="true" anywhere in my program.
The white strip is not part of my background.
When I screenshot it, it goes away (image is recreation of what it looks like in app)
This also happens at the top but it is less noticeable.
So my question is, how do I get rid of this?
I have the following layout XML:
<android.support.v7.widget.AppCompatSpinner
android:id="#+id/content_spinner"
style="#style/Widget.AppCompat.Spinner.Underlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/border"
android:entries="#array/books"
android:spinnerMode="dropdown"
android:theme="#style/large_spinner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
And #style/large_spinner looks like this:
<style name="large_spinner" parent="Widget.AppCompat.Light.DropDownItem.Spinner">
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">0dp</item>
<item name="android:textColor">#color/nearlyBlack</item>
<item name="android:textSize">30sp</item>
<item name="android:drawableRight">#drawable/ic_menu_camera</item>
</style>
Which gives me the camera icon to the right of the spinner, which is want. However when I drop down the spinner the icon is on every single item, which I dont want. I just want the icon to the right on the spinner, not in every single item.
How can i achieve this?
Try this
<android.support.v7.widget.AppCompatSpinner
android:id="#+id/content_spinner"
style="#style/Widget.AppCompat.Spinner.Underlined"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="#drawable/test"
android:entries="#array/books"
android:spinnerMode="dropdown"
android:theme="#style/large_spinner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:background="#drawable/test"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape>
<solid android:color="#android:color/white" />
<corners android:radius="4dp" />
<padding android:left="8dp" />
</shape>
</item>
<item android:gravity="left|bottom" android:drawable="#drawable/ic_menu_camera" />
</layer-list>
</item>
</selector>
style name="large_spinner"
<style name="large_spinner" parent="Widget.AppCompat.Light.DropDownItem.Spinner">
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">0dp</item>
<item name="android:textColor">#color/nearlyBlack</item>
<item name="android:textSize">30sp</item>
</style>
I want to make BottomNavigationView Menu in UpperCase, How can i do that without using 3rd party library?
Here is my xml code:
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#android:color/white"
android:foreground="?attr/selectableItemBackground"
app:itemIconTint="#color/bottom_nav_color"
app:itemTextColor="#color/bottom_nav_color"
app:menu="#menu/navigation" />
And navigation.xml as follows:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/navigation_home"
android:icon="#drawable/home_icon"
android:title="#string/title_home"
/>
<item
android:id="#+id/navigation_deals"
android:icon="#drawable/ic_deals"
android:title="#string/deals" />
<item
android:id="#+id/navigation_myBookings"
android:icon="#drawable/ic_my_bookings"
android:title="#string/title_my_bookings" />
<item
android:id="#+id/navigation_more"
android:icon="#drawable/ic_more"
android:title="#string/title_more" />
</menu>
Try this
Create a style like this BottomNavigationViewStyle
<style name="BottomNavigationViewStyle">
<item name="android:textAllCaps">true</item>
<item name="android:textSize">15sp</item>
</style>
Than use like this
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="#android:color/white"
android:foreground="?attr/selectableItemBackground"
app:menu="#menu/navigation"
app:theme="#style/BottomNavigationViewStyle" />
OUTPUT
Apply this theme to your bottom navigation
<style name="AppTheme2" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textAllCaps">true</item>
</style>
Problem
Status bar overlapping with Toolbar. I have tried to setting various attributes but it isn't working out. So now suggest me what to do with this issue and what is causing this issue.
One more thing to note is that I've used transparent status bar attribute in one other activity.
activity_symptom.xml
<?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"
android:fitsSystemWindows="true"
tools:context="com.example.nishantsikri.microdoctor.SymptomActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="#style/AppTheme.AppBarOverlay">
<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" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_symptom" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
app:srcCompat="#android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
content_symptom.xml
<?xml version="1.0" encoding="utf-8"?>
<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:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.example.nishantsikri.microdoctor.SymptomActivity"
tools:showIn="#layout/activity_symptom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/symptom1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Symptom 1" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:spinnerMode="dialog"
android:layout_gravity="start|center_vertical"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:minHeight="48dp"
android:paddingBottom="12dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingStart="24dp"
android:paddingTop="12dp"/>
<TextView
android:id="#+id/symptom2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Symptom 2" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:spinnerMode="dialog"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:minHeight="48dp"
android:paddingBottom="12dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingStart="24dp"
android:paddingTop="12dp"/>
<TextView
android:id="#+id/symptom3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Symptom 3" />
<Spinner
android:id="#+id/spinner3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:spinnerMode="dialog"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:minHeight="48dp"
android:paddingBottom="12dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingStart="24dp"
android:paddingTop="12dp"/>
<Button
android:id="#+id/button8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button"
tools:layout_editor_absoluteX="70dp"
tools:layout_editor_absoluteY="16dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
tools:layout_editor_absoluteX="127dp"
tools:layout_editor_absoluteY="170dp" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
styles.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowTranslucentStatus" tools:targetApi="19">true</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="21">true</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.Button" parent="Widget.AppCompat.Button.Colored">
<item name="colorControlHighlight">#color/indigo</item>
<item name="colorButtonNormal">#color/pink</item>
<item name="android:textColor">#color/White</item>
<item name="android:padding">20dp</item>
</style>
//Styles for Trending Topics Content Header Text
<style name="TextAppearance.Design.CollapsingToolbar.Expanded.Shadow">
<item name="android:shadowDy">0</item>
<item name="android:shadowDx">0</item>
<item name="android:shadowRadius">8</item>
<item name="android:shadowColor">#android:color/black</item>
</style>
<style name="AppThemeNavigation" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textColorPrimary">#android:color/white</item>
<item name="android:windowTranslucentStatus" tools:targetApi="19">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="windowActionBar">false</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="21">true</item>
</style>
</resources>