如何将layoutinfalter.inflate加载的view对象显示出来

2020-06-06 科技 95阅读
设置页面(即:更多页面和你)的Activity叫做:MoreActivity.java
对应的xml叫做main_more.xml
而整个TAB的界面Activity叫做:MainTabBottomActivity 对应的setContentView(R.layout.main_bottom);
叫做main_bottom.xml
然后要对更多界面的 第一栏
如何使用这个Relativelayout进行操作
[mw_shl_code=xhtml,true]
android:id="@id/BattleDore_more_ly_howtouse"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_marginTop="14dp"

android:background="@drawable/more_list_touch_item"

android:clickable="true"
android:onClick="onStartActivity"
android:gravity="center_horizontal|center_vertical" >
android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_centerVertical="true"

android:layout_toRightOf="@id/BattleDore_more_list_ruheshiyong"

android:padding="8dp"

android:text="@string/earth_more_howtouse"

android:textColor="#000"
android:textSize="17sp" />
android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentRight="true"

android:layout_centerVertical="true"

android:scaleType="matrix"

android:src="@drawable/earth_more_listmore" />

</RelativeLayout>[/mw_shl_code]
最后对应的更多第一栏 如何使用的
点击事件代码是这样的
[mw_shl_code=java,true]MoreLyHowtouse = (RelativeLayout)
findViewById(R.id.BattleDore_more_ly_howtouse);

MoreLyHowtouse.setOnClickListener(howtouseListener);
private
OnClickListener howtouseListener = new OnClickListener() {
public void onClick(View v) {
Toast.makeText(MoreActivity.this, "点击成功",
Toast.LENGTH_SHORT).show();
}

};
[/mw_shl_code]
但是Activity单独加载的时候可以点击事件操作SUCCES,如何结合TAB使用,就没法使用。
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com