[英]Unwanted margin android
我使用的是图像轮播,出于更多原因,轮播和标题栏或操作栏http://imgur.com/a/Pvonn之间有一个边距,因此我必须在顶部边距处添加一个负值不需要...
activity_main.xml中
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mock.vivofusion.MainActivity"
android:background="#f58b4c">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id ="@+id/viewPagerLayout">
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
.......
</RelativeLayout>
swipe_layout.xml(用于轮播)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id = "@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
如果需要,我还可以提供java类(代码是从网站“复制粘贴”的)。
LE:如何使滚动条仅在轮播区域上可访问? 我在任何地方滑动的图片都在不断移动。
android:scaleType="fitStart"
可能会有所帮助。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id = "@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitStart" />
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.