我坚持我的issue.Thing是,它的自定义选项卡Widget.In有多个
如首页
标签 - 新闻
- ABC
- PQR
。
I am stuck with my issue.Thing is that its a custom Tab Widget.In that have multiple
tab like Home
- News
- Abc
- PQR
.
该活动应该是这两个方位像纵向和横向
。所以对于每个标签具有两个XML
的肖像是储存在布局端口/ file.xml
和景观哪些在店布局陆/ file.xml
The Activity should be for both orientation like portrait and landscape
. so for that each tab have two xml
for portrait which is store at layout-port/file.xml
and landscape which store at layout-land/file.xml
有关管理方向纵向到横向我已经添加了机器人:configChanges =定位| keyboardHidden
中的每个活动规则标签
For manage orientation portrait to landscape i have added android:configChanges="orientation|keyboardHidden"
rule tag in each activity.
TAB_SAMPLE.java
设置页文件。
TAB_GROUP_ACTIVITY
每个选项卡组活动文件
file.java
任务文件
TAB_SAMPLE.java
Tab file.
TAB_GROUP_ACTIVITY
each Tab Group activity File
file.java
Task file
毕竟这个东西,我在这里得到的问题:
如果我添加
安卓configChanges = |在tab_sample方向keyboardHidden规则标签
的活动那么它的工作完美。像管理不同的看法。港口土地和土地上的端口,但它不工作的Home.java。
If i add
android:configChanges="orientation|keyboardHidden"rule tag in tab_sample
activity then its working perfect. like manage different view. port to land and land to port but its not working in Home.java.
现在,如果我删除机器人:configChanges =方向| keyboardHidden在tab_sample规则标签
的活动则其工作的家庭没有活动News.java
Now if i remove android:configChanges="orientation|keyboardHidden" rule tag in tab_sample
activity then its working for Home activity not for News.java
当我改变其保持相同的XML形式口不能再次layout-land.in感其呼叫的OnCreate()使用方向的意思。
Mean when i change the orientation its keeping same xml form port not use from layout-land.in the sense its call OnCreate() again.
所以当我发现可问题是标签控件。
更新
现在跟踪我的codeI获取主要问题后,在网格视图的活动,因为其唯一的活动是行不通的。
Now after tracing my code i get that main issue is in grid view activity because its only activity which is not working.
问题是标签之间的主机V / S网格视图
。我不知道为什么它不采取布局土地xml文件。我发现this因为同样的问题,但是,这个问题也
Issue is between Tab host v/s Grid View
. I don't know why its not taking layout-land xml file. i found this as same issue but no replay on that question also
看详情 manifestfile.xml 我想保持纵向和横向的所有活动。
see in Detail manifestfile.xml I want to maintain both portrait and landscape in all activity.
两个XML文件
请帮助我如何解决这个问题。
Please help me how to solve this.
Oooohhh最后我得到了上述问题的解决。它是非常困难的。
Oooohhh Finally i got the solution for above issue. It's was very difficult.
有关维持取向景观为纵向和国家反之亦然,我们通常将安卓configChanges =keyboardHidden |定位
下的活动属性标记。
For maintain the state of orientation Landscape to portrait and vice-versa we generally adding android:configChanges="keyboardHidden|orientation"
property tag under activity.
但在这里可问题是Tab_Group_活动
因为,我不能够保持在GridView的状态。 Grid_File.java
是只有单一的java文件,该文件是不处理的所有其他方向剩下的工作完美。
But here may be issue is Tab_Group_ Activity
due to that i am not able to maintain state in GridView. Grid_File.java
is Only single java file which was not handling the orientation rest of all other working perfectly.
现在,如果我删除机器人:configChanges =keyboardHidden |定位
从 TAB_SAMPLE.java
和它的处理只 Grid_File.java
不是别人。
Now if i remove android:configChanges="keyboardHidden|orientation"
from TAB_SAMPLE.java
then Its handling only Grid_File.java
not others.
mean that was keeping same Layout XML in landscape also where i have two separate XML File.
下面是我的解决办法:
我有添加机器人:configChanges =keyboardHidden |定位
在 TAB_SAMPLE.java
的以及为的
实施onConfigurationChanged(配置NEWCONFIG)格列
和定数。如 gridView.setNumColumns(6);
I have add android:configChanges="keyboardHidden|orientation"
in TAB_SAMPLE.java
as well as
implement onConfigurationChanged(Configuration newConfig)
and set Number of column of grid. like gridView.setNumColumns(6);
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
// gridView.setSelection(index);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
{
// Log.e("On Config Change", "LANDSCAPE");
gridView.setNumColumns(6);
} else
{
// Log.e("On Config Change", "PORTRAIT");
gridView.setNumColumns(4);
}
}
通常我们加入两种安卓configChanges =keyboardHidden |定位
在活动标签或实施onConfigurationChanged(配置NEWCONFIG)
但在这里,我已经写了两个。
Generally we are adding either android:configChanges="keyboardHidden|orientation"
tag under activity or implementing onConfigurationChanged(Configuration newConfig)
but here i have written both.