[android-developers] Re: Add Admob in PreferenceScreen at LiveWallpaper setting screen

2011-10-17 Thread Perry168
Learn more is better. :)

On 10月17日, 上午11時02分, Nikolay Elenkov 
wrote:
> On Mon, Oct 17, 2011 at 11:44 AM, Perry168  wrote:
> > I am very upset. The Admob haven't come out too.
>
> Too bad :) Consider that your users will open the preferences activity
> at most a couple of times. Displaying ads there would serve little
> purpose other than to annoy people. In short: don't.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Add Admob in PreferenceScreen at LiveWallpaper setting screen

2011-10-16 Thread Nikolay Elenkov
On Mon, Oct 17, 2011 at 11:44 AM, Perry168  wrote:
> I am very upset. The Admob haven't come out too.
>

Too bad :) Consider that your users will open the preferences activity
at most a couple of times. Displaying ads there would serve little
purpose other than to annoy people. In short: don't.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Add Admob in PreferenceScreen at LiveWallpaper setting screen

2011-10-16 Thread Perry168
I am very upset. The Admob haven't come out too.

On 10月17日, 上午12時35分, Kostya Vasilyev  wrote:
> The listview is taking the entire activity width and height (because of
> "fill_parent"), so the AdMob view is there, but is pushed beyond the
> edge of the screen.
>
> Try this on the listview:
>
> android:layout_height="fill_parent"
> android:layout_height="0px"
> android:layout_weight="1"
>
> And specify orientation=vertical on the LinearLayout: the default is
> horizontal, meaning the AdMob view is pushed to the right.
>
> And probably change the width to fill_parent on the AdMob view as well.
>
> -- Kostya
>
> 16.10.2011 20:19, Perry168 пишет:
>
>
>
>
>
> > Hi all,
>
> > Following is my new layout Admob XML file. And I use setContentView to
> > call this layout in PreferenceActivity. But I don't know why the Admob
> > can't show out.
> > Who can teach me what's my wrong?
> > It make me crazy because I wasted 2 days in this problem.
>
> >  >            android:layout_height="fill_parent"
> >            android:layout_width="fill_parent"
> >            xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads";
> >            xmlns:android="http://schemas.android.com/apk/res/android";>
>
> >  >                android:layout_width="fill_parent"
> >                android:layout_height="fill_parent" />
>
> >  >            android:layout_width="wrap_content"
> >            android:layout_height="70.0dip"
> >            ads:adSize="BANNER"
> >            ads:adUnitId=" >            ads:loadAdOnCreate="true" />
>
> > 
>
> --
> Kostya Vasilyev- 隱藏被引用文字 -
>
> - 顯示被引用文字 -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Add Admob in PreferenceScreen at LiveWallpaper setting screen

2011-10-16 Thread Kostya Vasilyev
The listview is taking the entire activity width and height (because of 
"fill_parent"), so the AdMob view is there, but is pushed beyond the 
edge of the screen.


Try this on the listview:

android:layout_height="fill_parent"
android:layout_height="0px"
android:layout_weight="1"

And specify orientation=vertical on the LinearLayout: the default is 
horizontal, meaning the AdMob view is pushed to the right.


And probably change the width to fill_parent on the AdMob view as well.

-- Kostya

16.10.2011 20:19, Perry168 пишет:

Hi all,

Following is my new layout Admob XML file. And I use setContentView to
call this layout in PreferenceActivity. But I don't know why the Admob
can't show out.
Who can teach me what's my wrong?
It make me crazy because I wasted 2 days in this problem.




http://schemas.android.com/apk/lib/com.google.ads";
xmlns:android="http://schemas.android.com/apk/res/android";>









--
Kostya Vasilyev

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Add Admob in PreferenceScreen at LiveWallpaper setting screen

2011-10-16 Thread Perry168
Hi all,

Following is my new layout Admob XML file. And I use setContentView to
call this layout in PreferenceActivity. But I don't know why the Admob
can't show out.
Who can teach me what's my wrong?
It make me crazy because I wasted 2 days in this problem.




http://schemas.android.com/apk/lib/com.google.ads";
xmlns:android="http://schemas.android.com/apk/res/android";>







-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Add Admob in PreferenceScreen at LiveWallpaper setting screen

2011-10-16 Thread Perry168
Because I tried too much solution within 2 days, following is a one
of
the solution.

layout/ad_layout.xml



http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">



AdPreference.java


public class AdPreference extends Preference {


public AdPreference(Context context, AttributeSet attrs, int
defStyle)  {super(context, attrs, defStyle);}
public AdPreference(Context context, AttributeSet attrs)
{super(context, attrs);}
public AdPreference(Context context) {super(context);}


@Override
protected View onCreateView(ViewGroup parent) {
// this will create the linear layout defined in
ads_layout.xml
View view = super.onCreateView(parent);


// the context is a PreferenceActivity
Activity activity = (Activity)getContext();


// Create the adView
AdView adView = new AdView(activity, AdSize.BANNER, "< ad id
>");


((LinearLayout)view).addView(adView);


// Initiate a generic request to load it with an ad
AdRequest request = new AdRequest();
adView.loadAd(request);


return view;
}



}


add to current setting.xml


http://schemas.android.com/apk/res/
android">


...





...


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Add Admob in PreferenceScreen at LiveWallpaper setting screen

2011-10-16 Thread Perry168
Because I tried too much solution within 2 days, following is a one of
the solution.

layout/ad_layout.xml


http://schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">





AdPreference.java

public class AdPreference extends Preference {

public AdPreference(Context context, AttributeSet attrs, int
defStyle) {super(context, attrs, defStyle);}
public AdPreference(Context context, AttributeSet attrs)
{super(context, attrs);}
public AdPreference(Context context) {super(context);}

@Override
protected View onCreateView(ViewGroup parent) {
// this will create the linear layout defined in
ads_layout.xml
View view = super.onCreateView(parent);

// the context is a PreferenceActivity
Activity activity = (Activity)getContext();

// Create the adView
AdView adView = new AdView(activity, AdSize.BANNER, "");

((LinearLayout)view).addView(adView);

// Initiate a generic request to load it with an ad
AdRequest request = new AdRequest();
adView.loadAd(request);

return view;
}
}



add to current setting.xml


http://schemas.android.com/apk/res/
android">

...



...





On 10月16日, 下午2時43分, TreKing  wrote:
> On Sat, Oct 15, 2011 at 9:35 PM, Perry168  wrote:
> > From the web, I found some solution. Unluckly, I don't know why the AD
> > haven't show on the screen.
>
> If you don't even explain what solution you tried and what's not working,
> you're not really going to get much help.
>
> ---­--
> TreKing  - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en