2010-09-01 20 views
0

我跟着页脚栏的@seanhodges样品(机器人导航栏底部): https://stackoverflow.com/questions/2369975?tab=votes#tab-top机器人,从呼叫按钮包括标签

是否有可能把它从包括标签,然后在运行时

访问每个按钮
<LinearLayout android:layout_alignParentBottom="true" 
    android:layout_height="wrap_content" android:layout_width="fill_parent"> 
    <include android:id="@+id/footer" layout="@layout/footer" /> 
</LinearLayout> 

从包含标记调用它时,它在屏幕上看起来不错。 我尝试在运行时达到的按钮,但可以得到它的工作..

我知道这是没有办法的办法,但我正在寻找这样的事情...

Button _BackButton= (Button)findViewById(R.id.footer); 

_BackButton.setText("new text"); 

Button _Backhome= (Button)findViewById(R.id.footer); 

_Backhome.setText("new text"); 

可以通过它来完成-include-标签?

感谢

回答

0

你应该使用这些按钮的ID从页脚布局中,使用您链接到您的例子可以通过这样得到的返回按钮:

Button _BackButton= (Button)findViewById(R.id.back); 

视图层次结构将请务必在查找指定的ID时查看包含的视图。

+0

其工作表示感谢! – ZoharAdar 2010-09-02 07:26:11