ROTATION
For some of my layouts I have used different layouts depending on the orientation. To let the activity change the layout dependong on the rotation I use this code.
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
int orientation = display.getOrientation();
if (orientation == 1 || orientation == 3)
setContentView(R.layout.accounteditland);
else
setContentView(R.layout.accountedit);
loadActivity();
}
You have to put it also in the onCreate.
loadActivity() is the method that do the rest of work of the activity.
BLACK LISTVIEW
I did use a ListView in one of my layouts and I have a problem. The problem is that when I move the list up and down it turns black. It is because I have a blackground color on that list. For resolve that I just put
android:cacheColorHint="#00000000"
On the LinearLayout.
Here is the link of the solution.
No hay comentarios:
Publicar un comentario