我可以使用旋转动画在占位符中加载微调器,直到使用Glide加载图像吗?
我试图用.placeholder(R.Drawable.spinner)做到这一点,没有动画出现?
如果有人可以帮助我,那会很棒吗?
谢谢!
嗨,我正在努力为我的项目创建发布版本.我已经通过SO/Google帮助在Progaurd上尝试了很多东西,但我仍然无法创建发布版本.
有人可以帮我这个吗?我总是遇到这个问题:
Run Code Online (Sandbox Code Playgroud)Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'. > java.io.IOException: Please correct the above warnings first.
这是完整的详细错误:http://justpaste.it/perror抱歉,我不得不把它作为一个链接,因为它是巨大的.
这是依赖项:
//compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.loopj.android:android-async-http:1.4.8'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile project(':pageIndicator')
compile 'com.github.neopixl:PixlUI:v1.0.6'
compile 'com.github.bumptech.glide:glide:3.6.1'
Run Code Online (Sandbox Code Playgroud)
我的progaurd文件:
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的应用上播放youtube视频.我理解这可以通过将活动扩展为YouTubeBaseActivity来实现,这样做我无法访问您的工具栏.
mActionBar = (Toolbar) findViewById(R.id.toolbar);
if (mActionBar != null)
{
setSupportActionBar(mActionBar);
}
getSupportActionBar().setTitle(getResources().getString(R.string.youtubetitle));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
Run Code Online (Sandbox Code Playgroud)
我得到getSupportActionbar无法解决.是否有一种通过扩展活动YouTubeBaseActivity来访问工具栏的简单方法.
我做错了吗?
谢谢!
我试图奇怪地改变工具栏微调器下拉主题这没有发生.当我点击微调器时,它总是会变暗.我希望背景为灰色,文字为黑色.
我没有任何动作栏.我通过工具栏设置一切.
因此我尝试了以下方法:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:minHeight="?attr/actionBarSize"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<RelativeLayout
android:id="@+id/relativeLayoutID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="left|center"
android:text="@string/register_title"
android:textColor="@color/whiteText"
android:textSize="@dimen/text_size_medium" />
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="80dp"
android:spinnerMode="dropdown"
android:visibility="gone" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)
风格xml:
<resources>
<style name="Theme.default" parent="Theme.AppCompat.Light.NoActionBar">
<item name="md_widget_color">@color/numbertext</item>
<item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:windowContentOverlay">@drawable/toolbar_dropshadow</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:editTextColor">@android:color/background_dark</item>
<item name="android:textColor">@android:color/background_dark</item>
<item name="colorControlNormal">@android:color/background_dark</item>
<item name="colorControlActivated">@color/orangeText</item>
<item name="colorControlHighlight">@color/orangeText</item>
<item name="android:statusBarColor">@color/colorPrimary</item>
</style>
<style name="Widget.MyApp.HeaderBar.Spinner" parent="Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">?android:selectableItemBackground</item>
<item name="android:dropDownSelector">?android:selectableItemBackground</item>
<item name="android:divider">@color/blackText</item>
<item name="android:overlapAnchor">true</item> …Run Code Online (Sandbox Code Playgroud) 我ArrayList用名字声明了10 秒arraylist1,arraylist2依此类推.
我想在for循环中动态更改变量名称:
for (int i = 1; i < 5; i++)
{
arraylist + (i).clear();
//arraylist1.clear();
//arraylist2.clear();
//arraylist3.clear();
//arraylist4.clear();
//arraylist5.clear();
}
Run Code Online (Sandbox Code Playgroud)
可能吗?如果是这样的格式是什么?
我正在尝试使ThumbnailView在我的ArrayAdapter上工作,但是出现以下错误:
java.lang.IllegalStateException: Not connected. Call connect() and wait for onConnected() to be called.
at com.google.android.youtube.player.internal.r.i(Unknown Source)
at com.google.android.youtube.player.internal.o.k(Unknown Source)
at com.google.android.youtube.player.internal.o.a(Unknown Source)
at com.google.android.youtube.player.internal.p.<init>(Unknown Source)
at com.google.android.youtube.player.internal.ac.a(Unknown Source)
at com.google.android.youtube.player.YouTubeThumbnailView$a.a(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
我的ArrayAdapter看起来像这样:
我的xml video_items.xml看起来像这样:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@drawable/listviewbox"
android:padding="10dp"
android:layout_height="match_parent">
<!-- Video Thumbnail -->
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="@+id/imageView_thumbnail"
android:layout_width="85dp"
android:layout_height="85dp"
android:layout_alignParentLeft="true"
android:layout_margin="5dp"
android:background="@color/panelcolor"
android:scaleType="centerCrop" />
<!-- Video Title -->
<TextView
android:id="@+id/video_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView_thumbnail"
android:layout_toRightOf="@+id/imageView_thumbnail"
android:paddingBottom="5dp"
android:paddingRight="5dp"
android:text="@string/videotext"
android:textColor="@android:color/black"
android:textSize="16sp" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这有什么问题吗?
我创建了一个列表视图并为其项目添加了边框。
像这样:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal"
android:background="@drawable/listviewborderbox"
android:padding="10dp" >
<LinearLayout
android:id="@+id/sharedbyyouNameLayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".70"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/sharedbyyoutext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="@string/sampletext1"
android:textColor="@color/blackText"
android:textSize="14sp" />
<TextView
android:id="@+id/sharedbyyouselected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:text="@string/sampletext2"
android:textColor="@color/blackText"
android:textSize="16sp"
tools:ignore="RtlHardcoded" />
</LinearLayout>
<LinearLayout
android:id="@+id/sharedbyyouLayoutforarrow"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".10"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_next"
tools:ignore="RtlSymmetry,RtlHardcoded,ContentDescription" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我在 Drawable-v21 中有这样的涟漪效应值:
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@android:color/white"> <item android:drawable="@color/footercolor"/> </ripple>
Run Code Online (Sandbox Code Playgroud)
drawable 文件夹中的边框形状 xml 是这样的:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" > …Run Code Online (Sandbox Code Playgroud) 我正在使用滑动库来显示图像.我试图通过使用以下代码清除滑动缓存:
Glide.get(MainActivity.this).clearDiskCache();
Glide.get(MainActivity.this).clearMemory();
Run Code Online (Sandbox Code Playgroud)
上面的代码在Async中,我在Do背景部分调用.
当我运行这个时,我总是得到:
Caused by: java.lang.IllegalArgumentException: You must call this method on the main thread
at com.bumptech.glide.util.Util.assertMainThread(Util.java:135)
at com.bumptech.glide.Glide.clearMemory(Glide.java:370)
Run Code Online (Sandbox Code Playgroud)
这可能有什么问题?如果我在MainThread中使用上面的内容,则要求在后台运行它.
如何清除缓存?
谢谢!
我正试图在点击卡片视图时添加涟漪效果,奇怪的是它没有出现?
这里可能有什么问题?
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/tools"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:layout_margin="5dp"
card_view:cardCornerRadius="6dp"
card_view:contentPadding="5dp"
card_view:cardElevation="4dp"
card_view:cardMaxElevation="6dp"
app:ignore="NamespaceTypo">
</androidx.cardview.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
// 我在cardview中有一个带有三个textview的线性布局。
回收者视图:
<LinearLayout
android:id="@+id/cardViewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:visibility="gone">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/cardList"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
谢谢!
是否可以在 android studio 的所有 Java 类中添加“创建者”注释......到目前为止,我正在执行旧样式的复制和粘贴。
这不是针对新类,而是针对项目中的现有类。
谢谢!
我正在尝试一个接一个地设置两个图标(共享和心形图标),并且奇怪地右对齐一个没有显示。像这样的东西:
我正在尝试所有方法,但无法实现。可能有什么问题。以下是我正在查看的内容:
我试过的代码:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="390dp"
android:id="@+id/imageRelativeLayout"
android:visibility="visible"
android:background="@android:color/white">
<TextView
android:id="@+id/labelProductModel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:visibility="visible"
android:ems="12"
android:text="Product Code"
android:textSize="12sp" />
<TextView
android:id="@+id/labelProductName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_below="@+id/labelProductModel"
android:ellipsize="end"
android:ems="12"
android:visibility="visible"
android:text="Product Name"
android:textSize="16sp"/>
<ImageView
android:id="@+id/imageProduct"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_below="@+id/labelProductName"
android:src="@drawable/action_video"
android:contentDescription="@string/app_name"
android:padding="4dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentBottom="true"
android:layout_below="@+id/imageProduct"
android:gravity="left">
<android.support.v7.widget.RecyclerView
android:id="@+id/listImages"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:visibility="visible"/>
</LinearLayout>
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:id="@+id/shareImage"
android:paddingTop="5dp"
android:contentDescription="@string/app_name"
android:visibility="visible"
android:src="@drawable/ic_share"/>
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/app_name"
android:layout_toRightOf="@+id/shareImage"
android:id="@+id/favImage"
android:visibility="visible"
android:src="@drawable/ic_heart"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我想检查当前时间是否是00:01 AM然后做一个特定的工作我正在尝试将时间转换为毫秒,当我这样做时,我得到不同日期的不同毫秒值.
我试过这个:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(getResources().getString(R.string.zerozero)));
cal.set(Calendar.MINUTE, Integer.parseInt(getResources().getString(R.string.one)));
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
long alarmtime = cal.getTimeInMillis();
long currenttime = System.currentTimeMillis();
Log.e("Value", "= " + alarmtime + " " + currenttime);
Run Code Online (Sandbox Code Playgroud)
当我这样做时:今天的毫秒:它显示1458066660000,明天它是:1458153060000
那么如何检查当前时间是否为00:01 AM?
如何比较当前时间与给定时间的简单方法..?
谢谢!
我有包含数字和文本的字符串。(数字也有十进制值。)我想检查字符串仅包含带十进制值的数字。
这是字符串:
String testValue = "One Time Password(OTP) for Debit Card ending 1234 is 359573. Pls use this OTP at HDFC Bank ATM(Language selection screen) to create your ATM PIN before 27Jan15"
Run Code Online (Sandbox Code Playgroud)
我正在提取该值以仅获取另一段代码中的数字。我将其存储在 testValue 中。有时我收到像上面这样的完整消息,我试图查找 testValue 是否只有数字......所以我尝试了以下操作:
if (Pattern.matches("[a-zA-Z]+", testValue ) == false && testValue.length() > 2)
{
Log.e("True","Only numbers);
}
Run Code Online (Sandbox Code Playgroud)
这是打印 True。
if (testValue.contains("[0-9]+"))
{
Log.e("True","Only numbers);
}
Run Code Online (Sandbox Code Playgroud)
这也是打印 True 。
if (testValue.matches(".*\\d+.*")
{
Log.e("True","Only numbers);
}
Run Code Online (Sandbox Code Playgroud)
这也是打印 True 。
上述所有条件都打印正确,我不知道为什么,因为它包含数字和字母?
如何检查 testValue 是否只有数字(也是小数)
谢谢!