problem after turning mobile horizontal

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

problem after turning mobile horizontal

Postby nbagade » Fri Jan 22, 2010 11:52 am

Hi,

I have developed application ,wehere i am using some images.

when I am holding mobile vertically it is working fine.but if i held mobile horizontally ,the position of images is changing which is looking bad UI.

Is there any way to avoid the position of images even if user hold the mobile horizontal.

I want user should run my app in vertical direction of mobile only. Can we force it?is there any api.

Thanks,
Narendra
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Top

Postby zorro » Fri Jan 22, 2010 1:39 pm

Add this in your Activity class, in OnCreate function, at the end:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


That should do the trick :)
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Postby nbagade » Fri Jan 22, 2010 3:51 pm

thanks.

It is working now.
If I want to remove the app name panel.
how I can remove that app name Panel which is at the top of application


Regards,
Narendra
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby zorro » Fri Jan 22, 2010 4:29 pm

You can switch to fullscreen in two ways, from the app or using the manifest file.

1. In activity onCreate function:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. protected void onCreate(Bundle savedInstanceState)
  2. {
  3.         super.onCreate(savedInstanceState);
  4.  
  5.         // set fullscreen
  6.         this.requestWindowFeature(Window.FEATURE_NO_TITLE);
  7.         this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  8.                         WindowManager.LayoutParams.FLAG_FULLSCREEN);
  9.         (...)
  10.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


OR

2. In manifest file:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <application android:icon="@drawable/icon" android:label="@string/app_name"
  3. android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
  4.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Second method is preffered.
User avatar
zorro
Experienced Developer
Experienced Developer
 
Posts: 71
Joined: Mon Aug 10, 2009 3:11 pm
Location: Romania

Postby nbagade » Fri Jan 22, 2010 4:33 pm

Thanks again.
can we change the Title color

Regards,
Narendra
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest