小编The*_*heQ的帖子

Android弹出窗口没有填充屏幕大小?

我正在尝试制作一个简单的弹出窗口.但是每次我制作一个,它最终都会变得非常小......而不是我想要它的长度.这是弹出窗口的样子: 在此输入图像描述

这是弹出窗口的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/popup_element"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#444444"
    android:padding="10px"
    android:orientation="vertical">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="Transfering data"
        android:textColor="@color/white"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="Status"
        android:textColor="@color/white"/>

    <TextView android:id="@+id/server_status_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Awaiting answer..."
        android:paddingLeft="10sp"
        android:textColor="@color/white"/>

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal"
        android:gravity="center_horizontal|bottom">

        <Button android:id="@+id/end_data_send_button"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:drawablePadding="3sp"
            android:layout_centerHorizontal="true"
            android:text="Cancel" />
    </LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的java代码:

private PopupWindow pw;
        private void bindActivity() {

            fabButton = (ImageButton) findViewById(R.id.activity_profileView_FAB);
            fabButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    initiatePopupWindow();
                }
            });


        }
     private void initiatePopupWindow() {
            try …
Run Code Online (Sandbox Code Playgroud)

android popupwindow android-popupwindow

15
推荐指数
2
解决办法
7万
查看次数

如何将图像上传到Firebase存储?

我正在尝试将一个简单的字节数组上传到Firebase存储中,但是我onFailureListener不断被调用并记录回来,说上传失败了.我希望你们能告诉我我的代码有什么问题.

在顶部,我得到了

 //Firebase
    private Firebase mRef;
    private StorageReference storageRef;
Run Code Online (Sandbox Code Playgroud)

然后进去 onStart()

@Override
protected void onStart() {
    super.onStart();
    googleApiClient.connect();
    //Firebase
    mRef = new Firebase("link to firebase account");
    FirebaseStorage storage = FirebaseStorage.getInstance();
    storageRef = storage.getReferenceFromUrl("link to storage");

}
Run Code Online (Sandbox Code Playgroud)

然后在我的 onActivityResult()

      @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            addImageImageView.setVisibility(View.GONE);
            if (requestCode == Constants.REQUEST_CODE && resultCode == RESULT_OK && data != null) {
                //First we gotta make sure to add the images to
                ArrayList<Image> imagesFromGallery = data.getParcelableArrayListExtra(Constants.INTENT_EXTRA_IMAGES);
                for (int …
Run Code Online (Sandbox Code Playgroud)

android android-image firebase firebase-realtime-database firebase-storage

11
推荐指数
2
解决办法
3万
查看次数

禁用在fragmentPagerAdapter中滑动? - android

嘿家伙我有一个fragmentPagerAdapter,里面有3个片段.如何禁用3个片段之间的滑动,以便用户只使用tabview在片段之间进行?

干杯!

private class ViewPagerAdapter extends FragmentPagerAdapter
{
    ArrayList<Fragment> fragments = new ArrayList<>();
    ArrayList<String> tabTitles = new ArrayList<>();

    public ViewPagerAdapter(android.support.v4.app.FragmentManager fragmentManager)
    {
        super(fragmentManager);
    }
    @Override
    public Fragment getItem(int position)
    {
        return fragments.get(position);
    }
    @Override
    public int getCount()
    {
        return fragments.size();
    }
    @Override
    public CharSequence getPageTitle(int position)
    {
        return tabTitles.get(position);
    }
    public void addFragments(Fragment fragment, String titles)
    {
        this.fragments.add(fragment);
        this.tabTitles.add(titles);
    }
}
Run Code Online (Sandbox Code Playgroud)

android android-layout android-fragments fragmentpageradapter android-pageradapter

8
推荐指数
2
解决办法
7711
查看次数

什么是iOS相当于android xml?

因此,我和我的同事已经在android中完成了我们的应用程序。现在,我启动ios / swift / xcode。似乎我有两个选择:故事板(可怕,因为当我拖放东西时,它做出了很多假设,就像在android中一样)。其次,我对所有ui都进行了硬编码,这很痛苦,因为在运行它之前我不知道它的外观。

在android中,我将所有布局都以xml格式编写,因为很高兴看到布局始终保持不变,而且我对布局有完全的控制权(不假设填充内容,边距以及布局的类型)。编写完xml之后,我会将其全部连接到Java中,这很漂亮。

现在在ios中,我看不到这种开发设计。我想以与之类似的方式或类似的方式进行开发,或者也许是“最佳”实践。我希望有人能提供一个非常好的关于如何解决此问题的见解。

xml android android-layout ios swift

6
推荐指数
1
解决办法
5396
查看次数

如何在android中模糊视图或布局?

我试图模糊一个视图或布局,就像我下面的例子.到目前为止,我只看到了模糊图像的例子,我对如何在布局上实现模糊感到困惑.我希望你们能帮忙!

在此输入图像描述

干杯!

android blur android-layout android-xml material-design

5
推荐指数
1
解决办法
1万
查看次数

如何在发布中运行Android应用程序而不是在调试中?

在我的应用程序中,我正在使用谷歌地图.现在,我意识到你有一个构建谷歌地图键和释放谷歌地图键.当我将已签名的apk发布到应用程序商店进行测试时,Google地图屏幕变为灰色.我必须继续签署一个新的apk并将其加载到Play商店然后测试它.

如何测试发布版本?请提供非常简单易用的分步说明,或者如果您知道如何使用谷歌地图解决问题会有所帮助.

这是我如何在我的发行版控制台中设置我的谷歌地图API的屏幕截图.

在此输入图像描述

google-maps google-maps-api-3 android-studio android-build-type

5
推荐指数
1
解决办法
2273
查看次数

清除所有活动的滑行缓存?

我的应用程序中的多个活动都有用户的个人资料图片。有一次,他们更改了个人资料图片,我想确保我的所有 Glide 实例的缓存都被清除。这样,当他们浏览应用程序时,他们可以看到更新的个人资料图片。

目前我正在使用这种方法:Glide.get(activity).clearDiskCache();这只会清除该活动的 Glide 缓存,而不是在我的应用程序中清除。

希望有人有一个快速的解决方案,我不需要为每个活动中的每个滑翔实例调用 .signature() 函数。或者清除每个活动中的每个滑行缓存。

android caching android-imageview android-glide

4
推荐指数
1
解决办法
5381
查看次数

如何在折叠工具栏时更改折叠工具栏的颜色?

我有一个折叠的工具栏,但我不能为上帝的爱弄清楚为什么它不会改变我想要的颜色,因为它崩溃...这是我的xml代码折叠工具栏.

<?xml version="1.0" encoding="utf-8"?>
<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="match_parent">
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/FrontierTheme">
        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp">
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="200dp"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax"
                android:src="@drawable/background"
                android:id="@+id/profileView_imageView"/>
            <android.support.v7.widget.Toolbar
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent" android:layout_height="wrap_content"
                android:id="@+id/toolbarProfileViewID"
                android:minHeight="?attr/actionBarSize"
                app:theme="@style/FrontierTheme"
                app:layout_collapseMode="pin">
            </android.support.v7.widget.Toolbar>
        </android.support.design.widget.CollapsingToolbarLayout>
        <android.support.design.widget.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_gravity="bottom"
            android:background="@color/mainColor"
            app:tabMode="scrollable"
            app:tabTextColor="@color/white"/>
    </android.support.design.widget.AppBarLayout>
    <android.support.v4.view.ViewPager
        android:id="@+id/tab_viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的styles.v21(我在常规styles.xml文件中没有任何内容)

<style name="FrontierTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:colorPrimary">#5F021F</item>
        <item name="android:colorPrimaryDark">#5E152C</item>
        <item name="android:colorAccent">#BCBCBC</item>
        <item name="android:textColor">#FFFFFF</item>
    </style>
Run Code Online (Sandbox Code Playgroud)

这是我的Android清单.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.daprlabs.swipedeck" >
 <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="23" /> …
Run Code Online (Sandbox Code Playgroud)

android android-xml android-toolbar android-collapsingtoolbarlayout

3
推荐指数
1
解决办法
5570
查看次数

如何做第一个bitbucket提交?

所以我对 bitBucket 很陌生。我希望得到一个非常简单的简单答案。

  1. 我有一个包含所有代码/项目文件的文件夹。

  2. 我设置了一个存储库。

现在,我如何连接两者?我在网上看,但每个人都显示不同的步骤。我没有写任何命令行。我的第一次初始推送从头到尾的命令行是什么?

git github bitbucket

3
推荐指数
1
解决办法
1万
查看次数

如何删除滑行缓存 - android?

所以我在我的应用程序中到处使用 glide 来通过 url 上传用户的个人资料图片。当用户更改他们的个人资料图片时。我更新了后端,所以更新了 url。但是,glide 已经缓存了旧图像。我如何覆盖之前缓存的图像,以便当用户浏览应用程序时,他/她可以在所有活动中看到他们的个人资料图片的变化?

android android-glide

3
推荐指数
1
解决办法
3782
查看次数