导航无法通过android中的页脚工作

时间:2013-08-02 08:00:48

标签: android android-layout navigation

想要添加页脚和两个可以导航到其他Activity的文本视图。我试过这样但导航不起作用.. 这是我的代码。 提前致谢。 我的xml代码是

..... ....

<RelativeLayout 
    android:id="@+id/RelativeLayout1"
     android:layout_alignParentBottom="true"
    style="@style/FooterBar" >

    <TextView
        android:id="@+id/TextView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:gravity="center"
        android:paddingTop="10dip"
        android:text="@string/uconnect_footer"
        android:textColor="#606060" />

    <TextView
        android:id="@+id/home_footter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="108dp"
        android:text="@string/home_footer"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/feedback_fotter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="32dp"
        android:layout_toRightOf="@+id/home_footter"
        android:text="@string/feedback_footer"
        android:textAppearance="?android:attr/textAppearanceSmall" />

</RelativeLayout> 

导航我的代码是:

home=(TextView)findViewById(R.id.home_footter);
        home.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent i=new Intent(getApplicationContext(),MainActivity.class);
                Toast.makeText(getApplicationContext(), "in home", Toast.LENGTH_LONG).show();
                startActivity(i);

            }
        });

        feedback=(TextView)findViewById(R.id.feedback_fotter);
        feedback.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent i=new Intent(getApplicationContext(),FeedBack.class);
                startActivity(i);
                Toast.makeText(getApplicationContext(), "in feedback Activtiy", Toast.LENGTH_LONG).show();

            }
        });

0 个答案:

没有答案