你如何获得Android的主要电子邮件地址(或电子邮件地址列表)?
我的理解是,在OS 2.0+上支持多个电子邮件地址,但在2.0以下,每个设备只能有一个电子邮件地址.
我想创建一个自定义对话框,如下所示

我尝试过以下的事情.
我创建了AlertDialog.Builder的子类,并使用了自定义标题和自定义内容视图并使用了它,但结果并不像预期的那样.
另一种尝试是继承DialogFragment并在onCreateDialog中自定义对话框,但结果不是预期的.
然后我尝试使用普通的Dialog类.结果并不像预期的那样.
在所有三种情况下,问题是当我忽略标题视图时,对话框的大小不是预期的,当我使用标题视图时,结果是内容视图周围有一个粗边框(实际上看起来很糟糕).现在我脑子里有两个问题......
我怎样才能做到这一点?由于我已经尝试了很多东西,因此我们将更加赞赏直接的答案.
在Android应用程序中显示错误或警告对话框的最佳方法是什么?
编辑 Android开发人员文档建议我们应该使用DialogFragments或Dialogs向用户显示错误/警报消息.但有一次他们说......
提示:如果需要自定义对话框,则可以将"活动"显示为对话框,而不是使用"对话框API".只需创建一个活动,并将其主题设置为清单元素中的Theme.Holo.Dialog.
那是什么意思?使用Activity只是为了显示错误消息是不是太多了?
如何将一些数据转移到另一个数据Fragment同样extras用于intents?
我想改变文本的大小Toolbar.因为在我的应用程序中,Toolbar文本对于横向和纵向模式都有不同的大小.
是否可以更改文本的文本大小Toolbar?
我有XML,这consits的DrawerLayout,CoordinatorLayout有custom views,AppBarLayout,NestedScrollView.
问题:当NestedtScrollView填充内容时,NestedtScrollView向下滚动.所有的研究,如scrollView.setScrollY(0)定制课程都layout_behavior = FixedScrollingViewBehavior没有帮助我.
我该如何阻止这种滚动
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:background="@color/semitransparet_color_primary">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/actionbar_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:elevation="4dp"/>
</android.support.design.widget.AppBarLayout>
<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<android.support.v4.widget.NestedScrollView
android:id="@+id/product_scroll_wrpr"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
// my content is here
</LinearLayout> …Run Code Online (Sandbox Code Playgroud) 我尝试在Android Studio中创建AVD,有各种皮肤类型,如HVGA,QVGA,WQVGA400 我不知道这些皮肤类型是什么,请解释创建AVD时要使用的皮肤类型.
我正在使用Android工具栏.我只想更改溢出菜单的背景颜色.但它并没有改变.
风格xml
<style name="MyDarkToolbarStyle" parent="Widget.AppCompat.Toolbar">
<item name="popupTheme">@style/PopupMenuStyle</item>
<item name="theme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
<style name="PopupMenuStyle" parent="android:Widget.Holo.Light.PopupMenu">
<item name="android:popupBackground">@android:color/white</item>
</style>
Run Code Online (Sandbox Code Playgroud)
工具栏XML
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ColorPrimary"
android:elevation="2dp"
android:theme="@style/MyDarkToolbarStyle" />
Run Code Online (Sandbox Code Playgroud) 我正在尝试查询由"Google Play音乐"应用创建的播放列表,但尚未能够这样做.我使用本地存储的内容创建了一个播放列表.我使用以下代码来查询:
Cursor c = managedQuery(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
new String[] {MediaStore.Audio.Playlists._ID,
MediaStore.Audio.Playlists.NAME
}, null, null, null);
Run Code Online (Sandbox Code Playgroud)
这适用于Winamp,但不适用于Google Play音乐.事实上,Winamp不会显示使用Google Play音乐创建的播放列表.但是,Google Play音乐会显示使用Winamp创建的播放列表.我的猜测是,Google Play音乐正在使用自己的数据库来存储播放列表,其他播放器使用内容提供商和uri MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI来存储播放列表.有没有办法让Google Play音乐创建播放列表?
我一直在尝试将自定义字体设置为android.support.v7.widget.SearchView查询提示和View.I中输入的文本.我尝试通过创建TypeFace对象动态地将字体从assests设置为searchView,但问题是"SearchView不包含一个setTypeface(Typeface tf)方法." 我确实尝试过自定义的SearchView类但找不到.
private void setFont(String font1, String font2, String font3)
{
Typeface tf = null;
tf = UiUtil.changeFont(MainActivity.this, font1);
btn1.setTypeface(tf);
tf = UiUtil.changeFont(MainActivity.this, font2);
btn2.setTypeface(tf);
tf = UiUtil.changeFont(MainActivity.this, font3);
btn3.setTypeface(tf);
tf = UiUtil.changeFont(MainActivity.this, font3);
// no set typeface method..
}
Run Code Online (Sandbox Code Playgroud) 我有SD-CARD文件和我的应用程序使用它作为日志文件.是否可以通过adb实时查看所有更改的文件?喜欢tail -f /sdcard/myfile.log命令.