开发者

how to handle orientation of an linearlayout control in android

![alt text][1]Hi folks

i am using admob ads for my android applicaiton.in portrait mode it fixed top of the screen when i changed to landscape mode.that add disply size of the portrait mode add size

how i get fill parent in landscape mode

+import com.admob.android.ads.AdManager; import com.admob.android.ads.AdView; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.Window; import android.view.ViewGroup.LayoutParams; import android.widget.LinearLayout;

public class narasimha extends Activity   {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);
        AdView adView = new AdView(this);
        adView.setVisibility(AdView.VISIBLE);
        adView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        adView.setPrimaryTextColor(Color.BLACK);
        adView.setBackgroundColor(Color.WHITE);
        adView.setSecondaryTextColor(Color.LTGRAY);
        adView.setRequestInterval(20);
       AdManager.setTestDevices(new String[]{ AdManager.TEST_EMULATOR});
        ((LinearLayout)findViewById(R.id.ad)).addView(adView);

portrait mode [1]: [url=http://www.freeimagehosting.net/][img]http://www.freeimagehosting.net/uploads/afd7c173cb.png[/img][/url]

landscape mode [url=http://www.freeimagehosting.net/][img]http://www.freeimagehosting.net开发者_如何学编程/uploads/1758519975.png[/img][/url]

how can resolve this problem


I don't think that will work because I think the ads are a fixed size. So your best bet is to probably just center the view in the layout.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜