Android 3.2以降、複数の画面サイズをサポートするためのドキュメントを読むと、smallestScreenWidthDp
条件付きでレイアウトを設定するために使用できますが、3.2より前のデバイスには何かありますか?
フラグメントベースのレイアウトがあり、画面サイズが600dpより大きい場合は、両方のフラグメントを画面に表示したいと思います。
これは、代替手段を見つけたいフラグメントを設定するために使用しているコードです。
public class MyActivity extends FragmentActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getResources().getConfiguration().smallestScreenWidthDp >= 600) {
finish();
return;
}
if (savedInstanceState == null) {
final DetailFragment details = new DetailFragment();
details.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit();
}
}
}