I am currently trying to theme an admob view and that work fine in Java code:
.addExtra("color_bg", "6D0504")
.addExtra("color_bg_top", "6D0504")
.addExtra("color_border", "6D0504")
.addExtra("color_link", "000080")
.addExtra("color_text", "808080")
.addExtra("color_url", "008000");
I could indeed make it work like this.
But i would like to work with xml and all the temptative I have tried have failed so far...
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="XXX"
ads:refreshInterval="60"/>
Something like
ads:color_bg="#6D0504"
does not work at all and I cannot find any inforùation in the official doc:
https://developers.google.com/mobile-ads-sdk/docs/admob/best-practices#adcolors
Any help would be highly appreciated.
You can style background and text color online in AdMob>Sites&Apps>App Settings (click here for direct link) and then setting Ad style to "use color set below:" where you can specify your own colors.
There are also some other interesting settings in that page, such as autorefresh rate.
Related
So I would like to see my layout preview with the fields filled with something like default placeholders but if I use bindings the settext attribute is already used and the fields are showing empty since there is no info from the models yet.
<TextView
android:id="#+id/tv_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:gravity="center"
**android:text="#{showBlueportSpotViewModel.name}"**
android:textAllCaps="true"
android:textSize="20sp"
android:textStyle="bold"/>
I tried this:
android:text="#{showBlueportSpotViewModel.name ?? #string/blueport_placeholder_name}"
but I still see the view empty.
Do you guys any workaround? I guess once a workaround is found, it can be used to ImageView and src for example and etc..
Thank you!
You can use the tools attribute to define properties that will appear in the layout preview but will not appear when you run the app.
Add the following to your root view:
xmlns:tools="http://schemas.android.com/tools"
Then use the tools attribute to define text that will only appear in the layout preview:
tools:text="placeholder text"
The tools attribute is very useful when mocking up views in the editor. All of the tools attributes are stripped when the app is packaged. More information here: http://tools.android.com/tech-docs/tools-attributes
I found a workaround
I added
xmlns:bind="http://schemas.android.com/apk/res/android"
to the layout
and just having duplicated declarations in the view like:
android:text="#string/blueport_placeholder_name"
bind:text="#{showBlueportSpotViewModel.name}"
or
android:src="#{showBlueportSpotViewModel.blueportImageDrawable}"
bind:src="#drawable/android_menu_header"
I don't really know if this has secondary wrong consequences so I won't accept this answer until somebody can comment and say if it is okay.. Thanks!
I'd like to create a DialogFragment or a Dialog with a TimePicker inside, just like in the following image. The problem is that my application is using the Holo.Light theme and then from there, I'm customizing it, but I can't find anything related to TimePicker.
Is it possible to assign a custom style to a TimePicker? I haven't found anything in the official Android documentation.
The following image is what I got so far, but still the TimePicker isn't in the color I want (it's the same orange as in the separator of the title) even tho in the XML I have it as it follows:
<TimePicker
android:id="#+id/picker"
style="#style/Checkmark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip" />
Any ideas, please?
Thanks a lot in advance
I use HoloEverywhere https://github.com/Prototik/HoloEverywhere to have native Holo elements in android 2.2 and up. You can style the picker easily if you use this library since it's open source and you get full access to the code.
Probably you don't need the whole library, it might be good to get only the TimePicker elements (beware of the dependency hell)
Searching through the web didn't give me the reference to neither the attributes which may be used when setting up AdMob's AdView in xml, nor the valid values used as AdRequest.extras.
The official documentation on AdView in XML gives just following example:
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, TEST_DEVICE_ID"
ads:loadAdOnCreate="true"/>
While the guide on extras specifies just following values:
color_bg Background color
color_bg_top Gradient background color at top
color_border Border color
color_link Link text color
color_text Text color
color_url URL color
So, are these values the only possible way to customize (not considering Targeting) the AdView and AdRequest or are there any unmentioned values/attributes?
The AdView also has an ads:keywords attribute which takes in a comma separated list of keywords. AdMob doesn't use the keywords at all though - it just passes them to AdSense backfill if you have that enabled.
I'm not aware of any other extras that AdMob itself uses. For those who are using DoubleClick for Publishers with AdMob, you can use the extras for custom targetting of your ad inventory.
I have created an Editbox in XML using this code:
<EditText
android:id="#+id/txtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:inputType="textEmailAddress" >
</EditText>
The textbox renders like this:
How can I get the native android EditText with the orange borders when focused, white background etc. ?
I tried adding
android:background="#android:color/white"
but that only changes the background to white.
The style you are seeing is "native" for the Honeycomb (3.0) Android version, specifically, the new Holo-dark theme. The orange-borders-and-white-background look was last used in 2.3.* and has since been left behind.
Agree with the answer of neutrino: The style you are seeing is "native" for the Honeycomb (3.0) Android version, specifically, the new Holo-dark theme.
But still if you wants the EditText that you want then you need to set the style/theme inside the AndroidManifest.xml file:
<activity android:theme="#android:style/Theme.Light">
when we add view's from layout, it renders from framework, then add the properties we provided . so in your code, EditText is native EditText, which varies from device to device . so if you want look and feel over a particular device make your own style for that and use it .
Had the same problem...
Try using:
EditText usr=(EditText)findViewById(R.id.editText1);
usr.setBackgroundResource(17301528);
If you really want to older versions of the EditText iamges (from sdk/android-8/platforms/data/res folder), place thema in the drawable folder, create a StateListDrawable out of it, and set the background of the EditText as that Drawable. But why bother ? Let app users enjoy the default look and feel of their device.
I like the title bar style from the Android preference category.
In my Activity (not a PreferenceActivity) How can I use the same style?
Since I just spent the last few hours trying to answer this old question, I'll do it here for anyone else.
It turns out the resource the preference category style is using is listSeparatorTextViewStyle.
You use it like this:
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello, World"
style="?android:attr/listSeparatorTextViewStyle"/>
Using style="?android:attr/preferenceCategoryStyle" didn't work.
The main layout is most likely a ScrollView with a LinearLayout. As for the individual layout, I believe (just guessing after looking at the documentation) that you can use the various attributes in android.R.attr - look here: http://developer.android.com/reference/android/R.attr.html. There are attributes like preferenceCategoryStyle, preferenceStyle, etc. You can apply any style to any of your views.