У меня есть активность
public class DeviceListActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_devices_list);
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
}
}
и в манифесте:
<activity android:name="com.myapp.DeviceListActivity"
android:screenOrientation="landscape"
android:theme="@style/Theme.AppCompat.Light.Dialog" />
Чтобы открыть его:
Intent intent = new Intent(this,
BluetoothDeviceListActivity.class)
startActivity(intent)
На моем Samsung Galaxy Tab A Android7.0 работает отлично, активность открывается как диалог, и я вижу содержимое.
![Working on Samsung Tablet](https://i.stack.imgur.com/BUYUi.png)
Но я пытаюсь сделать это на эмуляторе (WSVGA_7), работает под управлением Android 5.2, и диалоговое окно очень маленькое и пустое.
![Not working on 5.2](https://i.stack.imgur.com/YaPcz.png)
Как сделать так, чтобы действие Dialog выглядело одинаково для всех версий Android и не отображалось пустым?Я также попытался использовать Activity вместо AppCompatActivity, но та же проблема.
Спасибо
РЕДАКТИРОВАТЬ:
Вот файл макета для Activity: activity_devices_list.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<Button
android:id="@+id/scan_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:textSize="@dimen/unit_16_text"
android:textColor="@color/green"
android:text="@string/scan"
android:layout_alignParentEnd="true"
android:gravity="center"
android:textAlignment="center" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:max="100"
android:backgroundTint="@color/white"
android:indeterminateTint="@color/colorAccent"
android:visibility="invisible"
android:layout_below="@id/scan_button"/>
<ListView android:id="@+id/listViewDevices"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/progressBar"
/>
<TextView
android:id="@+id/title_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/progressBar"
android:layout_alignTop="@id/scan_button"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:layout_toStartOf="@id/scan_button"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:text="@string/settings_printers_connection_settings"
android:textColor="@color/green"
android:textSize="18dp"
android:textStyle="bold" />
</RelativeLayout>