Привет, У меня возникла проблема, когда экран нормальный, изображение выглядит нормально на телефоне Android, но когда я перехожу к пейзажу, он занимает пространство панели заголовка навигации. Также, когда я поворачиваю телефон, он возвращает меня домой или в главную деятельность. Я не так. следующее Главное-fragment.XMLAndroid Изменение поворота экрана
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.fred.yeno.MainFragment">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/puAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/dice" />
</LinearLayout>
</LinearLayout>
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.fred.yeu">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Ниже приводится MainFragment.java
package com.example.fred.yenu;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
*/
public class MainFragment extends Fragment {
public MainFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_main, container, false);
}
}
Вы можете направить код ландшафтной планировки plz – Fakher
хотите удалить возможность вращения? Или что? Добавьте код Фрагмента, возможно, вы ошиблись в объявлении панели инструментов или что-то еще, то же самое для фрагмента xml. – Dario
При повороте экрана активность будет создаваться снова. – thuongle