在片段android中的gridview中显示图像

时间:2014-04-01 23:50:32

标签: android gridview android-fragments

我正在尝试在我的代码下面发布的Android应用程序的片段内的gridview中显示一系列图片,尝试了一系列解决方案,但仍然遇到错误。

Discogaphy.JAVA

package com.GaslightApp.tab;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.learn2crack.tab.R;

public class Biography extends Fragment {
    @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {

            View android = inflater.inflate(R.layout.biography_frag, container, false);
            ((TextView)android.findViewById(R.id.textView)).setText("The Gaslight Anthem is a Punk Rock band formed in 2006 from the ruins of previous band This Charming man by Brian Fallon, Alex Rosamilia, Alex Levine And Benny Horrowitz. The band signed to XOXO records where they released their debut album Sink Or Swim. They then signed to SideOneDummy records where they released albums 2 And 3 The 59 Sound And American Slang. The band then signed to major label Mercury records where they are now after releasing 4th album Handwritten they are now in the studio with producer Mike Crossey recording their 5th album");
            return android;

    }}



  discography_frag.xml

    package com.GaslightApp.tab;


    import android.os.Bundle;
    import android.support.v4.app.Fragment;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.TextView;

    public class Discography extends Fragment {


        @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container,
                    Bundle savedInstanceState) {

                View Discography = inflater.inflate(R.layout.discography_frag, container, false);
                ((TextView)Discography.findViewById(R.id.textView)).setText("");
                return Discography;
    }}

mainactivity.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.learn2crack.tab"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/tga2"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.GaslightApp.tab.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

任何帮助都会非常感激,一直在努力争取这一点。

0 个答案:

没有答案