小编Ami*_*wal的帖子

如何在imageView上单击显示imageView全屏?

我从url获取图像并在imageView上显示它.此功能正常运行.但我希望当我点击该图像时,它必须是全屏的.那么如何实现这一功能呢?我知道我错过了什么.请帮我.屏幕截图已附上.我也想在我的应用程序中使用相同的功能.

点击之前 点击后

这是我的代码,我正在尝试图片点击:

    @Override
    public void onClick(View v) {
        if (isTouch1) {
            horizontalScrollView.setVisibility(View.GONE);
            isTouch1 = false;
            // mSystemUiHider.toggle();
            setTheme(R.style.FullscreenTheme);
            Log.d("Here isTouch is true", ">");
            // ChangeThemeUtils.changeToTheme(FullScreenImageAdapter.this, ChangeThemeUtils.THEME_HIDE_ALL_WINDOW);
            getSupportActionBar().hide();

        } else {
            isTouch1 = true;
            horizontalScrollView.setVisibility(View.VISIBLE);
            getSupportActionBar().show();
            setTheme(R.style.ExampleTheme);
            //mSystemUiHider.show();
            Log.d("Here isTouch is false", ">");    
        }
    }
Run Code Online (Sandbox Code Playgroud)

android fullscreen imageview android-fullscreen

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

按钮不是第一次单击调用OnClickListener

我正在尝试开发一个登录页面,其中我有用户名,密码和一个按钮.当我第一次单击该按钮时,没有任何反应,但是当我第二次单击该按钮时,它可以正常工作.我很困惑,为什么会这样?

activity_login.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash_bg"
tools:context=".LoginActivity" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="vertical"
android:layout_margin="30dp" >

<EditText
    style="@style/EditText1"
    android:id="@+id/userEditText"
    android:layout_marginBottom="50dp"
    android:inputType="textNoSuggestions"
    android:singleLine="true"
    android:hint="username" />
 <EditText
    style="@style/EditText1"
    android:id="@+id/passEditText"
    android:inputType="textPassword"
    android:layout_marginBottom="50dp"
    android:hint="password" />
<Spinner
    android:id="@+id/locationSpinner"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:popupBackground="#ffffff"
    style="@style/EditText1"
   android:layout_marginBottom="50dp" />
<Button
   style="@style/Button1"
   android:focusable="true"
   android:focusableInTouchMode="true"
   android:onClick="onLoginClick"
   android:text="continue"
         />
Run Code Online (Sandbox Code Playgroud)

loginActivity.java

 @SuppressLint("DefaultLocale")
    public void onLoginClick(View view) {
        String username = mUserEditText.getText().toString();
        String password = mPassEditText.getText().toString();
        String location = mLocationData.get(
                mLocationSpinner.getSelectedItemPosition()).toLowerCase();
        if (username.isEmpty() || password.isEmpty()) {
            CreatorMessenger
                    .getInstance()
                    .showMessage(this, "Error!!",
                            "You need …
Run Code Online (Sandbox Code Playgroud)

java xml android button

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

如何在Android中获取动画?

其实我有一个Linear LayoutmatchParent(在widthheight),现在我需要创建另一个layout(低于linearLayout),必须是不可见的最初。

当我的活动运行时,我想为隐藏的布局设置动画。

隐藏物layout必须从下到上。我不知道如何实现这个动画?我不知道如何创建最初不可见的布局,并且在延迟后必须从屏幕下方显示并向上显示?

这是我的xml文件代码

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/imageupLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imgview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/logo" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/hided_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="#56a24b"
        android:orientation="vertical"
        android:visibility="visible" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="15dip"
            android:background="@drawable/btn_bg"
            android:gravity="center" >

            <Button
                android:id="@+id/btn_login"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_margin="2dip"
                android:background="@drawable/btn_login" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center" …
Run Code Online (Sandbox Code Playgroud)

xml animation android android-layout

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

单击城市飞艇的推送通知打开Android应用程序?

我在Urban Airship的帮助下发送推送通知,并成功收到通知.但是,当我点击通知时,它不会打开我的应用程序.那么打开我的应用程序该怎么办?

并在logcate中得到以下错误: -

02-10 18:53:44.137: W/xxx - UALib(6840): Activity com.aaa.yyy.SplashActivity@40dcb458 was not manually added during onStart(). Call UAirship.shared().getAnalytics().activityStarted in every activity's onStart() method.
Run Code Online (Sandbox Code Playgroud)

android push-notification urbanairship.com

2
推荐指数
1
解决办法
1574
查看次数

2016016字节分配时内存不足.错误?

我正在下载波形(图像)并解码它们.它们的尺寸非常大.所以我的主要问题是,当我安装应用程序时,它工作得很好.但是经过一段时间后,Logcat突然发出以下错误.我想我保存了太多波形.所以现在我需要删除保存的波形.那么如何删除保存的波形?

02-21 17:06:30.146: I/dalvikvm-heap(13642): Clamp target GC heap from 259.610MB to    256.000MB
02-21 17:06:30.146: D/dalvikvm(13642): GC_FOR_ALLOC freed 453K, 2% free    257622K/262108K, paused 113ms, total 113ms
02-21 17:06:30.154: I/dalvikvm-heap(13642): Forcing collection of SoftReferences for 2016016-byte allocation
02-21 17:06:30.232: I/dalvikvm-heap(13642): Clamp target GC heap from 259.609MB to 256.000MB
02-21 17:06:30.232: D/dalvikvm(13642): GC_BEFORE_OOM freed 1K, 2% free 257620K/262108K, paused 85ms, total 85ms
02-21 17:06:30.240: E/dalvikvm-heap(13642): Out of memory on a 2016016-byte allocation.
02-21 17:06:30.240: I/dalvikvm(13642): "AsyncTask #5" prio=5 tid=18 RUNNABLE
02-21 17:06:30.240: I/dalvikvm(13642): …
Run Code Online (Sandbox Code Playgroud)

java android json out-of-memory

2
推荐指数
1
解决办法
3669
查看次数

在登录的apk中无法登录facebook?

当我测试应用程序时,我正在登录facebook.但是当我创建签名的apk时,我无法登录.我不知道发生了什么,因为当我正常测试应用程序时,相同的代码正在运行.请帮我.

java android facebook facebook-graph-api

2
推荐指数
1
解决办法
1113
查看次数