Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 包括旋转时更改的布局子项_Java_Android_Xml_Rotation_Views - Fatal编程技术网

Java 包括旋转时更改的布局子项

Java 包括旋转时更改的布局子项,java,android,xml,rotation,views,Java,Android,Xml,Rotation,Views,我最近开始将我的应用程序从iOS移植到Android,我有点挣扎。 我想做的是在一堆键值类型对中显示一些数据。 我正在使用包含的视图保存代码,下面是我的代码: detail\u verb.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_p

我最近开始将我的应用程序从iOS移植到Android,我有点挣扎。 我想做的是在一堆键值类型对中显示一些数据。 我正在使用包含的视图保存代码,下面是我的代码:
detail\u verb.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <TextView
                android:id="@+id/englishOutlet"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textSize="40sp"
                android:textIsSelectable="false"
                android:gravity="center_horizontal" />
            <include android:id="@+id/jeOutlet" layout="@layout/detail_verb_conjugation" />
            <include android:id="@+id/tuOutlet" layout="@layout/detail_verb_conjugation" />
            <include android:id="@+id/ilOutlet" layout="@layout/detail_verb_conjugation" />
            <include android:id="@+id/nousOutlet" layout="@layout/detail_verb_conjugation" />
            <include android:id="@+id/vousOutlet" layout="@layout/detail_verb_conjugation" />
            <include android:id="@+id/ilsOutlet" layout="@layout/detail_verb_conjugation" />
        </LinearLayout>
    </ScrollView>
每当我旋转局部视图时,由于某种原因,所有行都会更改为“Ils/Elles”,并且该字段的相应值也会更改。这是最后一排,有人能帮忙吗?

我遇到的问题与您的症状相同,经过多次实验后发现这是由于

android:textIsSelectable
属性。如果将其从xml中删除,旋转将开始正常工作。这应该是一些框架错误。我将为此提出一个问题

package co.uk.iVerbs.iverbsfrench;

import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.util.Log;
import android.view.MenuItem;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.content.Intent;

public class VerbDetail extends Activity {
    @SuppressLint("NewApi")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.detail_verb);
        Intent intent = getIntent();
        final DataModel verb = intent.getParcelableExtra("verb");
        setTitle(verb.infinitive);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            ActionBar actionBar = getActionBar();
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
        TextView textView = (TextView) findViewById(R.id.englishOutlet);
        textView.setText(verb.english);

        RelativeLayout rl = (RelativeLayout) findViewById(R.id.jeOutlet);
        textView = (TextView)jeOutlet.findViewById(R.id.pp);
        textView.setText("Je");
        textView = (TextView)jeOutlet.findViewById(R.id.con);
        textView.setText(verb.je);
        Log.d("asf", jeOutlet.toString());

        rl = (RelativeLayout) findViewById(R.id.tuOutlet);
        textView = (TextView)rl.findViewById(R.id.pp);
        textView.setText("Tu");
        textView = (TextView)rl.findViewById(R.id.con);
        textView.setText(verb.tu);

        rl = (RelativeLayout) findViewById(R.id.ilOutlet);
        textView = (TextView)rl.findViewById(R.id.pp);
        textView.setText("Il/Elle");
        textView = (TextView)rl.findViewById(R.id.con);
        textView.setText(verb.il);

        rl = (RelativeLayout) findViewById(R.id.nousOutlet);
        textView = (TextView)rl.findViewById(R.id.pp);
        textView.setText("Nous");
        textView = (TextView)rl.findViewById(R.id.con);
        textView.setText(verb.nous);

        rl = (RelativeLayout) findViewById(R.id.vousOutlet);
        textView = (TextView)rl.findViewById(R.id.pp);
        textView.setText("Vous");
        textView = (TextView)rl.findViewById(R.id.con);
        textView.setText(verb.vous);

        rl = (RelativeLayout) findViewById(R.id.ilsOutlet);
        textView = (TextView)rl.findViewById(R.id.pp);
        textView.setText("Ils/Elles");
        textView = (TextView)rl.findViewById(R.id.con);
        textView.setText(verb.ils);
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        // Respond to the action bar's Up/Home button
        case android.R.id.home:
            NavUtils.navigateUpFromSameTask(this);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
android:textIsSelectable