我坚持我的问题.Thing是它的自定义Tab Widget.In有多个选项卡,如 Home
- News
- Abc
- PQR
.
活动应该是 both orientation like portrait and landscape
. 因此,每个标签都有 two xml
用于纵向存储在 layout-port/file.xml
,而景观存储在 layout-land/file.xml
为了管理方向纵向到横向,我在每个活动中添加了 android:configChanges="orientation|keyboardHidden"
规则标记 .
-
TAB_SAMPLE.java
标签文件 . -
TAB_GROUP_ACTIVITY
每个选项卡组活动文件 -
file.java
任务文件
After all this stuff i get issue here :
如果我_____53685_ android:configChanges = "orientation|keyboardHidden" rule tag in tab_sample
活动那么它的工作完美 . 喜欢管理不同的观点 . 港口到陆地和陆地到港口,但它不在Home.java工作 .
现在,如果我_1153688_活动,那么它的Home活动不适用于News.java
意思是当我改变方向时,保持相同的xml表单端口不使用layout-land.in它再次调用OnCreate() .
所以当我找到 may be issue is in Tab Widget.
Update
现在跟踪我的代码后,我得到的主要问题是网格视图活动,因为它唯一的活动是无效的 .
Issue is between Tab host v/s Grid View
. 我不知道为什么它没有采用layout-land xml文件 . 我发现this同样的问题,但也没有重播这个问题
详见manifestfile.xml我想在所有活动中保持纵向和横向 .
请帮我解决这个问题 .
1 回答
Oooohhh最后我得到了上述问题的解决方案 . 这非常困难 .
为了保持方向的状态Landscape为portrait,反之亦然,我们通常在activity下添加
android:configChanges="keyboardHidden|orientation"
属性标签 .但是在这里
may be issue is Tab_Group_ Activity
由于我无法在GridView中维护状态 .Grid_File.java
是 Only single java file which was not handling the orientation rest of all other working perfectly.现在如果我_1753799_从
TAB_SAMPLE.java
然后 Its handling only Grid_File.java not others.Here is my solution:
我在
TAB_SAMPLE.java
中有add android:configChanges="keyboardHidden|orientation"
以及implement onConfigurationChanged(Configuration newConfig)
并设置网格列数 . 像gridView.setNumColumns(6);
通常我们在活动下添加
android:configChanges="keyboardHidden|orientation"
标签或implementing onConfigurationChanged(Configuration newConfig)
但在这里我写了两个 .