Remove padding in horizontal progress bar
Another way to do this is to use a Guideline and center ProgressBar between the parent top and the guideline.
<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:paddingTop="-4dp"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/guideline"
android:orientation="horizontal"
app:layout_constraintGuide_begin="4dp" />
Align ProgressBar horizontal to top (remove gap)
Pork'n'Bunny's answer worked API level 16 and up devices. This solution worked in all devices.
Just push it by 6dp up in XML.
<ProgressBar
android:id="@+id/progressbar_Horizontal"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="100"
android:layout_alignParentTop="true"
android:layout_marginTop="-6dp" />
ProgressBar and progressBarStyleHorizontal padding
Try to replace
<ProgressBar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:paddingTop="0dp"
android:paddingBottom="0dp"
android:id="@+id/fragment_article_progressBar"
android:visibility="visible"
/>
Via
<ProgressBar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:layout_marginBottom="-4dp"
android:layout_marginTop="-4dp"
android:id="@+id/fragment_article_progressBar"
android:visibility="visible"
/>
Removing default padding from TextField in version 1.2.0 includeFontPadding
Starting with 1.2.0
you can use the BasicTextField
+ TextFieldDecorationBox
.
You can set the trailingIcon
and you can use the contentPadding
attribute to change the paddings:
val colors = TextFieldDefaults.textFieldColors()
BasicTextField(
value = text,
onValueChange = { text = it },
modifier = Modifier
.fillMaxWidth()
.background(
color = colors.backgroundColor(enabled).value,
shape = RoundedCornerShape(8.dp)
),
interactionSource = interactionSource,
enabled = enabled,
singleLine = singleLine
) {
TextFieldDefaults.TextFieldDecorationBox(
value =text,
innerTextField = it,
singleLine = singleLine,
enabled = enabled,
visualTransformation = VisualTransformation.None,
label = { Text(text = "label") },
trailingIcon = {
IconButton(onClick = { }) {
Icon(imageVector = Icons.Filled.Clear, contentDescription = "Clear")
}
},
placeholder = { /* ... */ },
interactionSource = interactionSource,
// change the padding
contentPadding = TextFieldDefaults.textFieldWithoutLabelPadding(
top = 2.dp, bottom = 2.dp
)
)
}
Navigation Drawer remove horizontal start & end padding
You can use
For the icon start/left padding
Programmatically
navigationView.setItemHorizontalPadding(0);
XML
app:itemHorizontalPadding="0dp"
For the icon end/right padding
Programmatically
navigationView.setItemIconPadding(0);
XML
app:itemIconPadding="0dp"
Android, horizontal progressBar filled from center to sides
You could quite easily do this by yourself, by combining 2 progressbars.
1 to the left, that goes right-to-left, and 1 to the right, that goes left-to-right.
Then just set the same progress on both of them, without any space in between them. This would create the illusion of 1 progress bar that grows from the middle and outward.
If you really do want a library, this library could do it for you:
https://github.com/castorflex/SmoothProgressBar
Related Topics
Kotlin Error:Could Not Find Org.Jetbrains.Kotlin:Kotlin-Stdlib-Jre7:1.0.7
How to Share Image + Text Together Using Action_Send in Android
Android Studio: Duplicate Files Copied in APK Meta-Inf/Dependencies When Compile
"Gps" Location Provider Requires Access_Fine_Location Permission for Android 6.0
Which Can Replace Capturepicture Function
Calling Hidden API in Android to Turn Screen Off
Alertdialog.Getbutton() Method Gives Null Pointer Exception Android
How to Send Data Message Using Firebase Console
How Does Native Android Code Written for Arm Run on X86
Menuitem Tinting on Appcompat Toolbar
How to Change Toolbar Home Icon Color
Highlighting Text Color Using HTML.Fromhtml() in Android
How to Align Android Toolbar Menu/Icons to the Left Like in Google Maps App
How to Show a Marker in Maps Launched by Geo Uri Intent
How to Show One Layout on Top of the Other Programmatically in My Case