2014-02-12 56 views
0

我最近整合了StartApp到我的應用程序。現在,我不希望廣告成爲全尺寸廣告,我希望廣告的邊距小一點。現在我沒有對我的佈局做太多的改變,因爲我正在使用libGDX,所以之前我不必關心XML文件。這是我的main.xml中是什麼樣子:爲StartApp廣告添加保證金?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<com.startapp.android.publish.banner.Banner 
    android:id="@+id/startAppBanner" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
/> 

</LinearLayout> 

現在,我已經嘗試了各種東西,如添加android:layout_margin="10dp"android:padding="10dp"BannerLinearLayout,但這並不改變任何事情。所以我的問題是:有什麼方法可以實現我所期望的目標,如果有,如何實現?

回答

0

您應該使用'wrap_content'作爲'layout_width'和'layout_height',然後layout_margin應該可以工作。

對我來說,以下工作:

<com.startapp.android.publish.banner.Banner 
    android:id="@+id/startAppBanner" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="10dp" 
/>