对话片段嵌入取决于设备 [英] Dialog fragment embedding depends on device

查看:275
本文介绍了对话片段嵌入取决于设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序的用户挑选电话号码,或者从联系人或通话记录。采摘接触很简单,无论在手机和平​​板电脑的作品很好 - 我。即在手机上新的全屏活动弹出,表上我看到的联系人名单漂亮的弹出式​​对话框。

In my app user picks phone number either from contacts or call log. Picking contacts is quite simple and works nice both on phones and tablets - i. e. on phones new fullscreen activity is popped up and on tables I see nice popup dialog with list of contacts.

似乎是没有办法挑选从通话记录中的电话号码,所以我不得不来实现我自己的活动(通过ListFragment)。我想才达到相同的行为与接触 - 在平板电脑上我想看到列表视图弹出对话框,并在手机上我想看到全屏活动

It seems that there is no way to pick phone number from call log, so I had to implement my own activity (via ListFragment). I would like to achive same behavior as with contacts - on tablets I want to see popup dialog with list view, and on phones I want to see fullscreen activity.

这是可能才达到什么画上的这张照片,而无需像code:如果这是提出再展弹出否则启动新的活动,并使用这些自动拾取取决于设备只风格/布局?

It is possible to achive what is drawn on this pic without having code like: "if this is tabled then show popup else start new activity", and use only styles / layouts which are picked automatically depends on device?

推荐答案

似乎simpiest的解决方案 - 我用ListFragment,不希望把它献给DialogFragment - 是创造不同的主题取决于分辨率(和平台)。

It seems that simpiest solution - I use ListFragment and don't want to sacrifice it to DialogFragment - is to create different themes depends on resolution (and platform).

例如:

的Andr​​oidManifest.xml

<activity
    android:name="CallLogActivity"
    android:theme="@style/dialog_or_activity">
</activity>

\\价值观XLARGE-V11 \\ styles.xml

<resources>
    <style name="dialog_or_activity" parent="android:Theme.Holo.Light.Dialog">                 
    </style>
</resources>

\\值\\ styles.xml

<style name="dialog_or_activity" parent="android:Theme">        
</style>

这篇关于对话片段嵌入取决于设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆