如何更改 Android Facebook SDK 的对话框大小?它几乎是全屏,这对手机来说是可以的,但对平板电脑来说就不行了。我希望表格和电话的对话框大小不同。
最佳答案
为什么不在 Fragment 中实例化它或您想要的 fragment ?
这是 Webview Fragments 的文档 http://developer.android.com/reference/android/webkit/WebViewFragment.html
现在 Facebook 确实在他们的 SDK 中集成了一些原生 Fragment,例如 Picker Fragment: https://developers.facebook.com/docs/reference/android/3.0/PickerFragment
这是将 webfragment 放入 Layout
时的样子:
<fragment
android:id="@+id/webFragment"
android:layout_width="150dip"
android:layout_height="match_parent"
android:name="my.proj.WebViewer"></fragment >
您应该能够对平板电脑所需的内容进行 fragment 化。 Justin Breitfeller 在 stackoverflow 上发布了这段代码: How to detect 7" Android tablet in code
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
float widthInInches = metrics.widthPixels / metrics.xdpi;
float heightInInches = metrics.heightPixels / metrics.ydpi
double sizeInInchesSquared = (widthInInches * widthInInches) + (heightInInches * heightInInches);
//0.5" buffer for 7" devices (6.5^2 = 42.25) (7.5^2 = 56.25)
boolean is7inchTablet = sizeInInchesSquared >= 42.25 && sizeInInchesSquared <= 56.25;
我过去曾使用它来有效地为 7"及以上的屏幕制作不同的 View 。然后,您可以使用不同的 fragment 调用不同的布局,或者让 fragment 动态改变大小以有效地适应屏幕类型。
如果您能更详细地说明您正在尝试做什么,将会很有帮助。
关于android - 在 Android Facebook SDK 中更改对话框大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13410328/