0

我搜索了一个小时 - 我找不到错误:

public class favdetail extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.favdetail);
         setTitle("gespeicherter Artikel");

         Intent intent = getIntent();
         id = intent.getStringExtra("id");

         TextView t1 = (TextView)findViewById(R.id.favtextView1); // Überschrift
         t1.setText("sss");
    }
    }

我在清单中插入活动。此活动开始(主活动中的按钮单击) - 但不显示元素(来自布局 xml / textviews)!

更新: xml布局:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffff"
    android:visibility="gone"
    android:id="@+id/scrollmain"
    >

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
     >

    <TextView
            android:id="@+id/favtextView1"
            android:textColor="#000000" 
            android:text="ddd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="7dp"
            android:textAppearance="?android:attr/textAppearanceMedium" />


    <TextView 
    android:id="@+id/favtext3" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/favtextView1" 
    android:padding="7dp"   
    android:textAppearance="?android:attr/textAppearanceSmall"/>


<View
    android:id="@+id/imgv"
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:layout_below="@+id/favtext3"
    android:background="@android:color/darker_gray"/>

    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/imgv"
         ><requestFocus/></WebView>

</RelativeLayout>
</ScrollView>

我有一个类似布局的第二个活动。它在那里工作。

我的清单.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package=">>package name removed<<"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:hardwareAccelerated="true"
        android:uiOptions="splitActionBarWhenNarrow"
        android:theme="@style/AppTheme2" >
        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/title_activity_main" >


            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="android.app.default_searchable"
                   android:value=".Search" />
        </activity>

    <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".Search" >
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data android:name="android.app.searchable"
                   android:resource="@xml/searchable"/>
    </activity>

      <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".detail"></activity>
      <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".settings"></activity>
      <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".kategorie"></activity>
       <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".tag"></activity>
       <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".favoriten"></activity>
       <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".favdetail"></activity>

    </application>

</manifest>

解决了!

4

1 回答 1

7

你的visibility属性ScrollView没了,把它改成可见的

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:visibility="visible"
android:id="@+id/scrollmain"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
 >
<TextView
        android:id="@+id/favtextView1"
        android:textColor="#000000" 
        android:text="ddd"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="7dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />


<TextView 
android:id="@+id/favtext3" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_below="@+id/favtextView1" 
android:padding="7dp"   
android:textAppearance="?android:attr/textAppearanceSmall"/>


<View
android:id="@+id/imgv"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="@+id/favtext3"
android:background="@android:color/darker_gray"/>

<WebView
    android:id="@+id/webView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/imgv"
     ><requestFocus/></WebView>

</RelativeLayout>
</ScrollView>
于 2012-10-23T09:35:53.763 回答