如何在动作弹出窗口中添加标题

时间:2016-06-24 10:12:50

标签: android

Popup Library

我必须在弹出窗口中显示自己的标题

sample Screen

          here + sign and back arrow is header i want to exactly  like this

1 个答案:

答案 0 :(得分:0)

你可以使用下面的服装对话

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<beans:bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>

<context:component-scan base-package="com.app" />

<beans:bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />
<beans:property name="url" value="jdbc:mysql://localhost:3306/test" />
<beans:property name="username" value="xxx" />
<beans:property name="password" value="xxx" />
</beans:bean>

<beans:bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<beans:property name="dataSource" ref="dataSource" />
<beans:property name="annotatedClasses">
    <beans:list>
        <beans:value>com.app.Book</beans:value><!-- Models -->
<!--    <beans:value>com.com.app.Author
        </beans:value> -->
    </beans:list>
</beans:property>
<beans:property name="hibernateProperties">
    <beans:props>
        <beans:prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect
        </beans:prop>
        <beans:prop key="hibernate.hbm2ddl.auto">update</beans:prop>
        <beans:prop key="hibernate.show_sql">${hibernate.show_sql}</beans:prop>
    </beans:props>
</beans:property>
</beans:bean>

<beans:bean id="txManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<beans:property name="sessionFactory" ref="sessionFactory" />
</beans:bean>

<beans:bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

<context:component-scan base-package="com.app.books" />

<beans:bean id="bookDaoImpl" class="com.app.BookDaoImpl" /><!--daoImpl classes -->
<beans:bean id="bookServiceImpl" class="com.app.BookServiceImpl" /><!--serviceImpl classes

xml文件:

public class dialogMesssageType {
    Dialog dialog;
    Context m_context;
    Activity act;

    public void showDialog(Activity activity, Context context, final String titre, final String message, final int type) {
        dialog = new Dialog(activity);
        m_context = context;
        act = activity;
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setCancelable(false);
        dialog.setContentView(R.layout.dialog_message_type);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(context.getResources().getColor(android.R.color.transparent)));


        TextView txt = (TextView) dialog.findViewById(R.id.txt);
        TextView titre_id = (TextView) dialog.findViewById(R.id.txt_titre);
        TextView ok = (TextView) dialog.findViewById(R.id.confirmation);



        ImageView img_type(ImageView)dialog.findViewById(R.id.img_type);
        ImageView close = (ImageView) dialog.findViewById(R.id.close);

        txt.setText(message);
        titre_id.setText(titre);


        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        dialog.show();

    }


}

我删除了动画。