私は自分の組み込みプロジェクト用の Android アプリケーションに取り組んでおり、Android は初めてです。Android のあらゆる種類の画面 (すべての解像度) に適した UI を開発しました。
以下は、あらゆる種類の解決のための私のコードです。
if ( ((width>=240)&&(width<=320))&&((height>=320)&&(height<=480)) )
{
setContentView(R.layout.xsmall_layout);
}
else if( ((width>=360)&&(width<=480))&&((height>=640)&&(height<=720)) )
{
setContentView(R.layout.small_layout);
}
else if ( ((width>=480)&&(width<=540))&&((height>720)&&(height<=960)) )
{
setContentView(R.layout.medium_layout);
}
else if ( ((width>540)&&(width<=800))&&((height>=1024)&&(height<=1280)) )
{
setContentView(R.layout.vlarger_layout);
}
else if ( ((width>800)&&(width<=1080))&&((height>=1280)&&(height<=1920)) )
{
setContentView(R.layout.x_vlarger_layout);
}
else if ( ((width>=800)&&(width<=1024))&&((height>=480)&&(height<600)) )
{
setContentView(R.layout.wlarger_layout);
}
else if ( ((width>=1024)&&(width<=1280))&&((height>=600)&&(height<=800)) )
{
setContentView(R.layout.x_wlarger_layout);
}
else if ( ((width>=1280)&&(width<=2560))&&((height>800)&&(height<=1600)) )
{
setContentView(R.layout.xx_wlarger_layout);
}
正常に動作していますが、良い習慣ですか? そして私のPC(Intelデュアルコア、2GB RAM)では、コードの最後の解像度が機能していません。1920x1200 と 2560x1600 を試しました。Androidエミュレーターが実行されていないだけです。単に黒い画面が表示されます。これは私の PC の問題ですか、それとも何ですか? 助けて先輩……