我正在编写我的徽标活动和我的主要活动之间的过渡效果,但我有一个问题,即在消失之前,活动转移到顶部:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<alpha
android:duration="2000"
android:fromAlpha="0.0"
android:toAlpha="1.0" >
</alpha>
</set>
Run Code Online (Sandbox Code Playgroud)
我怎么能改进这个代码才能获得消失效果呢?
我有Android SQLite数据库的一个问题.
我有一个表包含一个field.StudentFname和该应用程序与Android 2.3.1正常工作,现在如果我添加另一个字段,那么我的应用程序无法正常工作.
任何人都可以帮助我了解数据库的人,
我开始在Android上开发应用程序了,所以我没有太多东西.到目前为止,我只是一个WebView.我在Android Studio中创建了项目,我的项目被设置为Android InstantApp.我不知道为什么/如何,但我的猜测是我在创建项目时忽略了它的选项.
我从WebView收到一个错误,说net :: ERR_CLEARTEXT_NOT_PERMITTED.当我搜索错误时,我看到当应用程序是InstantApp时,WebViews只能加载HTTPS的站点,并且无法加载HTTP站点.
这个应用程序的目的是成为一个非常简单的Flash播放器,只适用于一个站点.这是为了在运行需要Flash的游戏时获得更好的性能.这个游戏是在darkorbit.com,这是HTTPS.
MainActivity.java:
package com.tylerr147.darkorbit;
import android.content.ComponentName;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView wv = findViewById(R.id.webView1);
wv.loadUrl("https://darkorbit.com/");
wv.setWebViewClient(new CustomWebViewClient());
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setPluginState(WebSettings.PluginState.ON);
}
}
Run Code Online (Sandbox Code Playgroud)
和CustomWebViewClient.java
package com.tylerr147.darkorbit;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class CustomWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题:如何禁用我的应用程序作为InstantApp,或者如何让这个WebView显示该网站? …
我有多个LinearLayouts,其组合高度很容易超过设备的屏幕高度.所以为了使我的布局可滚动,我尝试添加一个ScrollView,但不幸的是我收到以下错误:
Scrollview只能容纳一个直接孩子
我做了一些研究,但即使在阅读了几个解决方案之后,也无法理解如何解决它.我尝试了一些改变,但到目前为止我没有任何作用.有帮助吗?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="20dip">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Question 1"
android:paddingBottom="20dip"
android:gravity="center" />
<TextView
android:id="@+id/q1_score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Question 2"
android:paddingBottom="20dip"
android:gravity="center" />
<TextView
android:id="@+id/q2_score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Question 3"
android:paddingBottom="20dip"
android:gravity="center" />
<TextView
android:id="@+id/q3_score"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:gravity="center"/>
</LinearLayout> …Run Code Online (Sandbox Code Playgroud) 我有一个CoordinatorLayout包含AppBarLayout和FrameLayout包含片段的a.
其中一个片段包含一个TabLayout顶部,一个列表槽RecyclerView和底部一个"自制"工具栏.
在AppBarLayout配置了app:layout_scrollFlags="scroll|enterAlways"
我的问题是当滚动时,两个"工具栏"都隐藏了,AppBarLayout和我底部的"自制"工具栏.这是当前的行为
我想修复底部的"自制"工具栏以保持可见但我无法实现它.
这是片段Layout的XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
>
<android.support.design.widget.TabLayout
android:id="@+id/toolbarfilter"
android:layout_width="match_parent"
android:background="@color/azul_asde"
app:tabMode="fixed"
app:tabMaxWidth="0dp"
android:elevation="4dp"
app:tabIndicatorColor="@color/verde_pastel"
android:layout_height="wrap_content"
/>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipeContainer"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/toolbarselection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:background="@color/azul_asde"
android:elevation="4dp"
android:visibility="visible"
>
<ImageView
android:id="@+id/delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_delete_white_24dp"
android:tint="@color/gris_desactivado" />
<ImageView
android:id="@+id/select"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_bookmark_border_white_24dp"/>
<ImageView
android:id="@+id/send"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" …Run Code Online (Sandbox Code Playgroud) android android-layout android-toolbar android-coordinatorlayout
在使用ListView自定义适配器的旧代码中,我可以使用此代码获取项目.
Message msg = (Message) adapter.getItem(poistion);
Run Code Online (Sandbox Code Playgroud)
现在我正在实施RecyclerView.我如何从中获取物品RecyclerView.adapter?
今天我正在尝试Glide在我的Android应用程序中使用图像加载器,同时使用这个我面对的方法没有解决问题.
Glide
.with(this)
.load(R.drawable.image_default_profile_picture)
.into(mUserImage);
Run Code Online (Sandbox Code Playgroud)
这段代码工作得很好.但是当我尝试这个时
Glide
.with(this)
.load(R.drawable.image_default_profile_picture)
.placeholder(R.mipmap.ic_launcher)
.fitCenter()
.into(mUserImage);
Run Code Online (Sandbox Code Playgroud)
然后这句话无法解决方法fitCenter(),placeholder.我错过了什么?
我使用以下代码作为if语句的结果显示toast消息:
Toast.makeText(getBaseContext(), "Please Enter Price", Toast.LENGTH_SHORT).show();
Run Code Online (Sandbox Code Playgroud)
它在白色背景上显示为白色文本,因此无法读取!我的问题是,我怎样才能改变吐司文字的颜色?
之间有什么准确的区别appbar,Toolbar,Actionbar?什么时候专门使用它们?我试着找到它们,但它让我感到困惑,所以任何好友都可以向我解释它们之间的确切区别以及何时使用它们或者这是单个组件的同名吗?
android android-actionbar android-toolbar android-appbarlayout
我正在尝试实施滑动以删除与Gmail应用"滑动到存档"相同的内容:
我已经尝试了很多教程,但没有一个像gmail一样快,我更喜欢不在外部库上工作.我该怎么做?
编辑:
我的代码到目前为止 -
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
public boolean onMove(RecyclerView recyclerView,
RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
// final int fromPos = viewHolder.getAdapterPosition();
// final int toPos = viewHolder.getAdapterPosition();
// // move item in `fromPos` to `toPos` in adapter.
return true;// true if moved, false otherwise
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {
//Remove swiped item from list and notify the RecyclerView
mAdapter.notifyItemRemoved(viewHolder.getLayoutPosition());
}
};
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback);
itemTouchHelper.attachToRecyclerView(mRecyclerView);
Run Code Online (Sandbox Code Playgroud)
我已设法启用滑动手势,但 …