如图所示,这里的蓝色图像并没有完全移动到顶部。我希望能够将这个蓝色条移动到上面黑色条的边界上,但是小的灰色区域在那里,我无法在图形布局中移动它。
编辑:这是 XML
<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"
android:background="#F3F3F3" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="124dp"
android:background="@drawable/roundedcorner"
android:ems="10"
tools:ignore="TextFields" >
<requestFocus />
</EditText>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/bluebars" />
</RelativeLayout>
编辑:我的临时解决方案我以编程方式更改了图像的对齐方式。
ImageView iv;
iv = (ImageView)findViewById(R.id.imageView1);
iv.getLayoutParams().height = 265;
我称其为临时解决方案,因为这是我将使用的解决方案,直到我找到更好的方法(我是relativelayout的新手),并且此修复可能会在更大/更小的设备上导致问题。所以不推荐,但在我找到更好的方法之前会这样做。
最佳答案
将其放入您的菜单文件中的应用程序标记中。
android:theme="@android:style/Theme.Light.NoTitleBar"
并且删除这个如果您已在代码中添加:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
关于java - 我将如何移动我的蓝色条形图像以覆盖所有灰色区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21672782/