1..出现在滑动解锁的手机上, 在进行锁屏的时候横屏被转为了竖屏,再缓慢解屏时候竖屏显示的横屏布局界面错乱很不美观,
2.这个无法从应用层上很好的解决,只能用笨办法掩盖错乱的界面就行,用在原有的基础上再套一层FrameLayout ,同时在main 的下方加入imageView_mid3 用于设置再竖屏时候显示掩盖住main
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/com.ubtechic.alpha1blooth"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#040c3f"
android:orientation="horizontal"
tools:context="com.ubtechinc.activity.RemoteControlActivity" >
<LinearLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#040c3f"
android:orientation="horizontal" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<RelativeLayout
android:layout_width="260dp"
android:layout_height="260dp"
android:layout_gravity="center" >
<Button
android:id="@+id/imageView_mid"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:clickable="true" />
</RelativeLayout>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.3" >
<RelativeLayout
android:layout_width="260dp"
android:layout_height="260dp"
android:layout_gravity="center" >
<Button
android:id="@+id/imageView_mid1"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:clickable="true" />
</RelativeLayout>
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1.2"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="260dp"
android:layout_height="260dp"
android:layout_gravity="center" >
<Button
android:id="@+id/imageView_mid2"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:clickable="true" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<Button
android:id="@+id/imageView_mid3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
android:visibility="gone" />
</FrameLayout>
3. 配置acitivity
<activity
android:name=".MainActivity2"
android:configChanges="orientation|keyboardHidden|screenSize"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
4.重写
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
// land donothing is ok
imageView_mid3.setVisibility(View.GONE);
Log.i("zdy", "ORIENTATION_LANDSCAPE");
} else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
imageView_mid3.setVisibility(View.VISIBLE);
Log.i("zdy", "ORIENTATION_PORTRAIT");
// port donothing is ok
}
}