我的UU界面,其布局如下:

需要修改的部分:

意见反馈居中,还有增加backbutton

首先在mainactivity中找到我的UU的定义:dialogue

public void showAboutDialog() {
if(mAboutDialog == null) {
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View aboutView = inflater.inflate(R.layout.aboutuu_layout, null, false);
Button backBnt = (Button)aboutView.findViewById(R.id.backbutton);
backBnt.setOnClickListener(mViewClickListener);
TextView versionTxt = (TextView)aboutView.findViewById(R.id.versiontext);
RelativeLayout versionCheckLayout = (RelativeLayout)aboutView.findViewById(R.id.checkversion);
versionCheckLayout.setOnClickListener(mViewClickListener);
RelativeLayout frameCheckLayout = (RelativeLayout)aboutView.findViewById(R.id.checkframe);
frameCheckLayout.setOnClickListener(mViewClickListener);
// RelativeLayout focusWbLayout = (RelativeLayout)aboutView.findViewById(R.id.focusweibo);
// focusWbLayout.setOnClickListener(mViewClickListener);
// RelativeLayout focusWxLayout = (RelativeLayout)aboutView.findViewById(R.id.focusweixin);
// focusWxLayout.setOnClickListener(mViewClickListener);
RelativeLayout marketScore = (RelativeLayout)aboutView.findViewById(R.id.toscore);
marketScore.setOnClickListener(mViewClickListener);
RelativeLayout contactsLayout = (RelativeLayout)aboutView.findViewById(R.id.contactus);
contactsLayout.setOnClickListener(mViewClickListener);
RelativeLayout fansLayout = (RelativeLayout)aboutView.findViewById(R.id.introtomyfriend);
fansLayout.setOnClickListener(mViewClickListener); if(isNeedAd == true) {
RelativeLayout rl_ad= (RelativeLayout)aboutView.findViewById(R.id.rl_ad);
banner=new DiandeBanner(this,banner_AD_ID);
if(banner != null) {
// rl_ad=(RelativeLayout)findViewById(R.id.rl_ad);
rl_ad.addView(banner);
banner.show();
}
}

根据R.layout找到各个对应的xml文件

,意见反馈对应的是contactus.进入它的监听中,监听按键找到它的xml入口。

 OnClickListener mViewClickListener = new OnClickListener() {

		@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.checkversion:
UpdateManager manager = new UpdateManager(CameraActivity.this);
if (manager.isNetworkConnected()) {
manager.checkUpdate();
} else {
manager.showNetworkDialog();
}
break; case R.id.toscore:
Uri uri = Uri.parse("market://details?id="+getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
startActivity(intent);
}catch(ActivityNotFoundException e) {
CustomToast.showToast(CameraActivity.this, R.string.toast_appmarket_not_installed, Toast.LENGTH_SHORT);
}
break;
case R.id.checkframe:
if (mCurrentModule instanceof PhotoModule) {
PhotoUI ui = ((PhotoModule) mCurrentModule).getPhotoUIInstance();
if (ui != null) {
PhotoFrameUpdateManager photoFrameManager =
new PhotoFrameUpdateManager(CameraActivity.this, ui);
if (photoFrameManager.isNetworkConnected()) {
// photoFrameManager.checkUpdate();
startActivityForResult(new Intent(CameraActivity.this, KuangDownloadActivity.class), REQ_CODE_DOWNLOAD);
} else {
photoFrameManager.showNetworkDialog();
}
}
}
break;
case R.id.contact_weibo:
followWB();
break;
case R.id.contact_weixin:
showFollowWxDialog();
break;
case R.id.contactus:
showContactsFunc();
break;
case R.id.contact_fans:
showFansforumPage();
break;
case R.id.introtomyfriend:
Intent recIntent = new Intent(Intent.ACTION_SEND);
recIntent.setType("text/plain");
recIntent.putExtra(Intent.EXTRA_TEXT, CameraActivity
.this.getString(R.string.rec_app_msg)+Constants.UU_LINK_URI);
startActivity(recIntent);
break;
case R.id.backbutton:
if(mAboutDialog != null) {
mAboutDialog.dismiss();
mAboutDialog = null;
}
break;
case R.id.backbutton1:
if(mFeedBackDialog != null) {
mFeedBackDialog.dismiss();
mFeedBackDialog = null;
}
break;
}
}
};

找到R.id.contact_weibo,点击进入xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff" > <RelativeLayout
android:id="@+id/title"
android:layout_height="@dimen/about_title_height"
android:layout_width="match_parent"
android:background="@color/aboutuu_title"
>
<TextView
android:id="@+id/title_text"
android:layout_width="match_parent"
android:layout_height="@dimen/about_title_height"
android:gravity="center"
android:text="@string/contact_us"
android:textColor="#ffffff"
android:textSize="@dimen/about_title_text_size"
android:background="@color/aboutuu_title"
android:paddingLeft="@dimen/about_title_btn_margin_left"/> <Button
android:id="@+id/backbutton1"
android:layout_width="@dimen/about_title_height"
android:layout_height="@dimen/about_title_height"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/about_title_btn_margin_left"
android:background="@drawable/about_back" />
</RelativeLayout>

将其 android:gravity="center"变成居中,还有增加Button,因为增加Button后提示android:layout_centerVertical="true"应用于相对布局,所以将线性布局改成相对布局。布局文件修改iwanbi后在JAVA文件中增加监听:

if(mFeedBackDialog == null) {
LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View fbView = inflater.inflate(R.layout.feedback_layout, null, false);
Button backBn = (Button)fbView.findViewById(R.id.backbutton1);
backBn.setOnClickListener(mViewClickListener);

利用inflater引入布局文件,定义按钮,引用公共监听类,公共监听类中增加按钮backbutton1.

android脚步---UI界面修改,增加按钮和监听的更多相关文章

  1. android脚步---UI界面修改,关于activity中增加按钮和监听

    增加按钮和监听,这个和上个不同在于,它不是在一个dialog里面,而是从新写了一个activity,因此需要先找到这个activity的入口. case R.id.checkframe: if (mC ...

  2. Android 给按钮添加监听事件

    在安卓开发中,如果要给一个按钮添加监听事件的话,有以下三种实现方式 1.方式一 public class MainActivity extends ActionBarActivity { @Overr ...

  3. Android软键盘的隐藏显示、事件监听的代码

    把开发过程中重要的一些内容片段做个珍藏,如下资料是关于Android软键盘的隐藏显示.事件监听的内容,应该是对小伙伴们有所用途. public class ResizeLayout extends L ...

  4. IOS第五天(1:取消按钮的监听和设置代理textField字数限制)

    ***********取消按钮的监听和设置代理textField字数限制 UITextFieldDelegate #import "HMViewController.h" @int ...

  5. Android开发之手势滑动(滑动手势监听)详解

    Android开发之手势滑动(滑动手势监听)详解 在Android应用中,经常需要手势滑动操作,比如上下滑动,或左右方向滑动,处理手势滑动通常有两种方法:一种是单独实现setOnTouchListen ...

  6. android CheckBox控件的定义及事件监听

    http://www.beijibear.com/index.php?aid=336 android CheckBox控件的定义及事件监听,本例实现CheckBox控件的定义及点击事件的监听并显示结果 ...

  7. Android TV开发中所有的遥控器按键监听及注意事项,新增home键监听

    原文:Android TV开发中所有的遥控器按键监听及注意事项,新增home键监听 简单记录下android 盒子开发遥控器的监听 ,希望能帮到新入门的朋友们 不多说,直接贴代码 public cla ...

  8. Android——控制UI界面

    一.使用XML布局文件控制UI界面 res\layout\activity_main.xml代码如下: <FrameLayout xmlns:android="http://schem ...

  9. Android控制UI界面

    ⒈使用XML布局文件控制UI界面[推荐] Android推荐使用XML布局文件来控制视图,这样不仅简单.明了,而且可以将应用的视图控制逻辑从Java或Kotlin代码中分离出来,放入XML文件中控制, ...

随机推荐

  1. HDU 3410 Passing the Message

    可以先处理出每个a[i]最左和最右能到达的位置,L[i],和R[i].然后就只要询问区间[ L[i],i-1 ]和区间[ i+1,R[i] ]最大值位置即可. #include<cstdio&g ...

  2. JTAG上有多个设备时,该如何接呢?

    首先要了解JTAG管脚相关定义,具有JTAG口的芯片都有如下JTAG引脚定义(是相对芯片): TCK——测试时钟输入: TDI——测试数据输入: TDO——测试数据输出: TMS——测试模式选择,TM ...

  3. CSS样式与选择器

    CSS构造块的样式: 1.  h1{color:red;background-color:yellow} 其中:h1是选择器,花括号内是声明部分.多个声明之间用分号隔开. 2.为样式规则添加注释:/* ...

  4. 解决centos网速特别慢的最佳解决办法

    摘自:http://www.centoscn.com/CentosBug/osbug/2014/0614/3138.html 我使用了centOS,但是发现网速实在是卡得几乎不能上网,连百度都打不开, ...

  5. ftp以及smb的配置

    linux下ftp服务的配置1,打开终端,cd /etc/vsftpd2   vi   vsftpd.conf3   相关的都打开说明:    anonymous_enable=YES  //允许匿名 ...

  6. 高可用开源方案 Keepalived VS Heartbeat对比

    最近因为项目需要,简单的试用了两款高可用开源方案:Keepalived和Heartbeat.两者都很流行,但差异还是很大的,现将试用过程中的感受以及相关知识点简单总结一下,供大家选择方案的时候参考. ...

  7. MFC下对串口的操作以及定时器的调用

    最近研究了一下MFC下对串口的操作,测试了一下对设备的读写. 1.打开串口 GetDlgItem(IDC_BUTTON_OPEN)->EnableWindow(FALSE); m_hComm = ...

  8. 使用SQL Server Management Studio 创建作业备份数据库

    在项目中,经常需要备份数据库,如果能做到只需点个按钮(“开始备份数据库”按钮),然后什么都不管,数据库就自动备份好了,或者服务器上的数据库隔一段时间自动备份一次,那该多好啊. Sql server 的 ...

  9. git 提交到github时不用每次都输入用户名,密码

    Permanently authenticating with Git repositories, Run following command to enable credential caching ...

  10. 学习笔记:GLSL Core Tutorial – Vertex Shader(内置变量说明)

    1.每个Vertex Shader都有用户定义的输入属性,例如:位置,法线向量和纹理坐标等.Vertex Shaders也接收一致变量(uniform variables). uniform vari ...