安卓开发的常见问题之让控件两端对齐

如下代码让位于同一行的两个控件分别左对齐和右对齐:

<RelativeLayout

xmlns:Android="http://schemas.android.com/apk/res/android"

Android:background="@drawable/top"

Android:layout_width="fill_parent"

Android:layout_height="wrap_content"

><ImageView

Android:id="@+file_browser/imgRefresh"

Android:layout_width="wrap_content"

Android:layout_height="wrap_content"

Android:layout_marginLeft="10px"

Android:src="@drawable/refresh"

Android:layout_centerVertical="true"

>

</ImageView>

<ImageView

Android:id="@+file_browser/imgCheck"

Android:layout_alignParentRight="true"

Android:layout_width="wrap_content"

Android:layout_height="wrap_content"

Android:layout_marginRight="10px"

Android:src="@drawable/close"

Android:layout_centerVertical="true"

>

</ImageView>

</RelativeLayout>
相关推荐:
键盘区域外才是屏幕的边缘,定义布局文件时使用:android:gravity="bottom"的话就会被挤到上部。 解决办法: 在此工程的androidMainfest.xml文件中对应的Activity中写入 android:windowSoftInputMode="adju …
在manifest.xml中定义Debuggable项,如果该项被打开,app存在被恶意程序调试的风险,可能导致泄漏敏感信息泄漏等问题。 显示的设置manifest的debuggable标志为false
sdcard存储的信息可以被其他应用任意读取,如果有敏感信息会造成信息被恶意应用获取风险。 通过内部存储存文件openFileOutput(filename, Context.MODE_PRIVATE)或者对于敏感的数据加密后存储。
当系统辅助功能中的任意一项服务被开启后,所有由系统提供的WebView都会被加入两个JS objects,分别为是”accessibility” 和 “accessibilityTraversal”,如果应用使用了系统的WebView,并且设置了setJavaScr …
android:layout_gravity="center_vertical"
拿起手机扫一扫即可带走我!