Change layout no internet access admob (Android) - layout

I want to change the properties of my layout, like the margins or the position (above, rigth of, left of..) when there's not internet access and AdMob ads cannot be shown. I don't know how to change these layout properties in my activities and set the layout to full screen. Anyone can help me? Thanks

If the layout is occurring in a LinearLayout, Set the addView layout's visibility to View.GONE
If you are using a RelativeLayout and using margins to prevent the addLayout overlapping your content, then try something like this:
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(0,0,0,0);
myLayout.setLayoutParams(lp);

Related

Change UITextView height according to screen size

I am trying to change the height of my textview through code when the 4 inch screen is detected. Unfortunately I cant get my current code to work. Can anyone see what is wrong? Both ways its written it doesn't work. In the code I show both ways I've tried. I have this written in viewDidLoad method too.
If this cannot be worked out then can anyone help me out to set height attribute value in attribute inspector for both the screens (with height 568 and 480)
my code,
if ((int)[[UIScreen mainScreen] bounds].size.height==568)
{
[myTextView setFrame:CGRectMake(20.0f, 78.0f, 280.0f, 415.0f)];
}
uncheck 'use autolayout' from interface builder and use 'autosizing' from interface builder to resize your textview height

Spinner Layout Closed different From Layout of Each Row

The layout of my spinner while close is adopting the layout of the layout configured to each row of the spinner.
The layout for each row is defined inside getCustomView method because I am using a custom adapter to the spinner, here it is define:
public View getCustomView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=getLayoutInflater();
View row=inflater.inflate(R.layout.row, parent, false); //here is the layout for each row -> R.layout.row
//there are more things here but doesnt matter for the question..
}
On that layout (row.xml) I have margins top and bottom, because I want to give soem space between the choices.. But then the button itself of the spinner, I mean, the layout of the spinner while closed also has the margins.. and it looks larger than what I want.
It is possible to define different layouts?
I tryed to make the spinner layout at xml using less height, but then I can see the option clearly.. because it has margins..
Did I make myself clear?
Thanks alot in advance.. If someone didnt understand I can explain better.
Thanks ;)
Finnaly found a solution to this problem :)
Didn't know that getDropDownView was for the dropdown layout and the getView was for the single layout, at closed spinner...
Solution here: Android Spinner with different layouts for "drop down state" and "closed state"?

How to add an view on top on activity layout dynamically which automatically shifted the old view down

I am working on an App in which I have an icon on Action Bar.When I click on this Action Bar icon then an EditText should come on the top of layout(below Action Bar) and all of the other data on layout should shif down.I am using Relative Layout.
I know how we can dynamically add view in relative layout.But here I have to add item on top on layout, while there is also some view on top before clicking the icon.
Try the below if it works for you, this is what you'll need as per my understanding of your question.
EditText et = new EditText(this);
empty.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
et.setText("Dynamic EditText!");
et.setMinLines(1);
et.setMaxLines(3);
relativelayout.addView(et);
// assuming you already have your relative layout and the rest declared.

javafx 2.0 TitledPane how to change the title text to image+text

the default title only contains text, just like the "Apples" title in the above image.
is that possible to add image in the title.
or
is there a way developer can build a customized TitledPane ?
thanks
Use setGraphic method
TitledPane tp = new TitledPane("hi");
tp.setGraphic(new Rectangle(10, 10));
As far as I know, you can set the graphics via the css property "-fx-graphic" as well.
See Oracle Defintion for JFX and CSS, here for elements of type Labeled.
To remove the button completely, you could either
set tp.setCollabsible(false); or
use the .titled-pane CSS class to set the property "-fx-collapsible" to false.
See Here (same side as above, but for TitledPane).

I want a different title to appear in the navigation bar for each imageview in my scroll view (xcode 4.2, iOS 5.0)

I have a scroll view, and when a user moves from one imageview to the next, I want the title in the navigation bar to change. So I want to set a new title for the navigation bar for each image in the scroll view. How would I go about doing this?
Thank you very much for your help.
Write a delegate for your scroll view. In the delegate, implement the scrollViewDidScroll: method to figure out which image is currently visible and change the title.
To eliminate your incompatible type warning, you can declare that ScrollViewController adopts the UIScrollViewDelegate protocol:
#interface ScrollViewController : UIViewController <UIScrollViewDelegate>

Resources