我遇到了一個小問題:我無法將視圖顯示在右側或左側的屏幕上......在eclipse的圖形佈局預覽中,它看起來像這樣:Android:查看不在正確的地方
如果我把它上傳到我的Galaxy Tab 3(10.1" ),它看起來一模一樣...... 這裏的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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:id="@+id/layout"
tools:context=".MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:gravity="left"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
正如你所看到的,android:layout_alignParentLeft
和android:layout_alignParentTop
設置爲true
...
@dimen/activity_vertical_margin
和@dimen/activity_horizontal_margin
的默認值爲16dp。
它不僅僅關注TextViews,還包括我試用過的所有其他視圖。如果我選擇其他的屏幕尺寸小於10.1" ,認爲是在正確的地方。
任何人都可以幫我嗎?
謝謝!
的墊襯去掉填充 – user2511882
嘗試刪除我們的相對佈局 –
哦左,右補白,這就是它!比你!但是你能說我爲什麼這樣表現嗎?正如我上面寫的,它只在10.1上「像這樣...... – marius