问题描述
在here
下面是我的XML布局:
Here is my xml layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<ImageButton
android:id="@+id/imageButton"
android:layout_width="40dip"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:contentDescription="@string/descrp"
android:scaleType="center"
android:src="@drawable/some_drawable"
android:visibility="visible" />
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<ProgressBar
android:id="@+id/progressbar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_alignParentBottom="true" />
</RelativeLayout>
我
如何让进度触摸屏幕边框没有进度条和边框之间的差距?
How can I make the ProgressBar touch the border of the screen without any gap between the progress bar and border?
推荐答案
我找到了一个工作around.I我基本上增加了layout_marginBottom = - 4DP我的进度和包裹它的RelativeLayout内,它对准的底部父view.This变化可能会破坏你的应用程序选择以后更好的解决方案设计与自己的自定义绘制一个自定义的进度条,你可以正确地调整和占用更少的空间帆布相比,progressBarStyleHorizontal。
I found a work around.I am basically adding a layout_marginBottom="-4dp" to my ProgressBar and wrapped it inside a RelativeLayout and aligned it to the bottom of the parent view.This changes may break your app in the future.For a better solution design a custom progress bar with your own custom drawable which you can align correctly and occupies less canvas space compared to the progressBarStyleHorizontal.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<ImageButton
android:id="@+id/imageButton"
android:layout_width="40dip"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:contentDescription="@string/descrp"
android:scaleType="center"
android:src="@drawable/some_drawable"
android:visibility="visible" />
<TextView
android:id="@+id/textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:textColor="#FFFFFF"
android:textStyle="bold" />
//changes
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/some_other_id"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-4dp" />
</RelativeLayout></RelativeLayout>
这篇关于如何使进度触摸屏幕底部边框的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!