我在android中創建了表視圖。在穩定的android屏幕它看起來像5列和相關的數據... 但我想添加另一個3列時,android旋轉...這是可能的? 怎麼樣?當Android屏幕旋轉時執行一項新任務
在此先感謝...
我在android中創建了表視圖。在穩定的android屏幕它看起來像5列和相關的數據... 但我想添加另一個3列時,android旋轉...這是可能的? 怎麼樣?當Android屏幕旋轉時執行一項新任務
在此先感謝...
如果u要修復橫向視圖上perticular活動THNü的hve添加機器人:screenOrientation = 「風景」 到烏爾manifiest文件..
如:
activity android:name=".Classname" android:screenOrientation="landscape"
========================
and if u want to do diffrent in Landscape or Portrait view thn u have to use
following into starting of ur onCreate() method.
if (this.getResources(). getConfiguration(). orientation == Configuration.ORIENTATION_LANDSCAPE) {
//== add view or action u want to perform
}
else if (this.getResources(). getConfiguration(). orientation == Configuration.ORIENTATION_PORTRAIT){
//== add view or action u want to perform
}
好嗎...!
當您旋轉設備時,活動重新啓動。你可以保存你的當前狀態(如果需要的話),如果你旋轉,只需檢查oncreate。
然後,您可以添加(或刪除)列。您可以查看onConfigurationChanged。像這樣:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
yourFunctionThatDoesColumnMagic();
}
一定要向manifest.xml添加代碼,以便在此情況下更改時不重新啓動。
android:configChanges="keyboardHidden|orientation"
一個好點的是在人的意見:你的確能讓佈局,土地XML,但要記住,你仍然必須再次調用setContentView()
東西時,在上述方法中的一種改變!
您可以在layout-land文件夾中添加橫向佈局xml。當方向更改爲橫向時,此xml將由android調用。 – Salil 2011-04-08 11:04:30
好點。添加到澄清回答 – Nanne 2011-04-08 11:25:09