【发布时间】:2013-12-04 20:53:13
【问题描述】:
由于某种原因,我的 ViewPager(经典按钮)上的 android:layout_gravity="bottom" 和 android:layout_alignParentBottom="true" 似乎没有将图像放在屏幕底部,我不确定为什么。
非常感谢任何建议。
屏幕截图:
XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView
android:id="@+id/left_drawer"
android:layout_width="120dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtubeplayerview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.idg.omv.ui.widget.VideosListView
android:id="@+id/videosListView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="70dip"
android:layout_alignParentBottom="true" >
<ScrollView
android:id="@+id/groupScrollView"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
</ScrollView>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:src="@drawable/scroll_lt_arrow" />
<Button
android:id="@+id/fav_up_btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="@drawable/fav_up_btn1" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@drawable/scroll_rt_arrow" />
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
【问题讨论】:
-
您是否尝试过任何其他
scaleType值?看起来fitXY在这里引起了您的问题。我想你要么在寻找center要么centerCrop。 -
它已经居中了……为什么要把它移到布局的底部?
-
我只需要将“经典”/ViewPager 移动到底部而不是屏幕中间
-
啊,我明白了。我一直在尝试解决这个问题,我只是去阅读 Nav Drawer 文档;你不能这样做。检查我的答案。
标签: java android xml android-layout android-ui