本当に私を狂わせさせることがあります。画面のレイアウトがランドからポートレートに正しく変わることはありません。画面の向きと断片
このように私は、それに向きのものと.xmlファイルを処理するために、私のレイアウトフォルダ内の2つのフォルダがあります。
layout\main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment
android:id="@+id/menu"
android:name="br.trebew.odonto.MenuData"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<fragment
android:id="@+id/princ"
android:name="br.trebew.odonto.FragList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
及びその他:
layout-large-land\main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="290dp"
android:layout_height="fill_parent">
<fragment
android:id="@+id/menu"
android:name="br.trebew.odonto.MenuData"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<fragment
android:id="@+id/princ"
android:name="br.trebew.odonto.FragList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<fragment
android:id="@+id/fdetalhe"
android:name="br.trebew.odonto.DetalheFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
私の主なJavaクラスがありますOdontO.javaは次のとおりです。
public class OdontO extends FragmentActivity implements OnDateChangeListener, OnAgendaItemClickListener {
FragList fList;
MenuData mData;
DetalheFragment frag_detalhe;
private boolean detalhesInLine;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i("LayoutOr", "Entrou no onCreate OdontO");
mData = (MenuData) getSupportFragmentManager().findFragmentById(R.id.menu);
fList = (FragList) getSupportFragmentManager().findFragmentById(R.id.princ);
frag_detalhe = (DetalheFragment) getSupportFragmentManager().findFragmentById(R.id.fdetalhe);
detalhesInLine = (frag_detalhe != null &&
(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE));
if (detalhesInLine) {
fList.enablePersistentSelection();
}
else if (frag_detalhe != null) {
frag_detalhe.getView().setVisibility(View.GONE);
}
}
画面が回転しているよりも肖像画ならば、それは正しく変更されます。
問題は逆です。画面が回転よりも陸地の場合、レイアウトは変更されません。実際にはonCreateメソッドが正しく呼び出されますが、レイアウトはポートレートに変わりません! =/
誰でも知っているだろうか?
まあ...あなたは(両方の組み合わせ)と同じようにフォルダ名を変更しましたが、まだ動作しません!以前と同じです! =/ – trebew
何かを意味するのか分かりませんが、仮想デバイスでのみテストしました。 Android 2.3.3、APIレベル10、画面サイズ:720x960、密度:240. – trebew
これ以上の謝辞はありますか? – trebew