2016-09-30 69 views
1

這個問題的標題並不完全反映我的問題,我修剪它,因爲它太長。對不起我的英文不好。如何覆蓋庫中活動的screenOrientation屬性

好吧,

我使用的具有活性的圖書館,我用我的應用程序,活動。該活動的方向在平板電腦中工作良好,即風景和肖像,但在手機中,它仍然採用肖像模式。

當我看到該庫的清單文件它像

<activity 
    android:name="DrawingActivity" 
    android:configChanges="orientation|keyboardHidden|screenSize" 
    android:finishOnTaskLaunch="true" 
    android:screenOrientation="unspecified"> 

在線程Android Orentation Changes。我開始知道它應該像android:screenOrientation =「fullSensor」一樣工作。

現在我試圖重寫活動的screenOrientation財產說使用here

tools:replace屬性,但還是它不工作。請任何人都可以幫助我解決這個問題。

這就是我想要實現的。

<activity 
    android:name="DrawingActivity" 
    android:configChanges="orientation|keyboardHidden|screenSize" 
    android:finishOnTaskLaunch="true" 
    android:screenOrientation="fullSensor" 
    tools:replace="android:screenOrientation"> 

如果我的問題不清楚/太廣泛請讓我知道我會編輯我的問題。

問候

回答

0

導入庫作爲模塊,而不是使用搖籃,所以你可以改變代碼

0
<activity 
    android:name="DrawingActivity" 
    android:configChanges="orientation|keyboardHidden|screenSize" 
    android:finishOnTaskLaunch="true" 
    android:screenOrientation="fullSensor" 
    tools:replace="screenOrientation"> 

不使用android:screenOrientation改用screenOrientation

+0

它沒有工作的任何其他建議嗎? – ImGenie