下面是我的协调员布局的代码.它运作良好.
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="#f4f4f4"
app:expandedTitleMarginEnd="16dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/echo3"
android:fitsSystemWindows="true"
android:scaleType="centerCrop" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#fff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Private Albums"
android:textColor="#000"
android:textSize="22sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/anim_toolbar"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<include layout="@layout/content_profile" />
<!--<fragment-->
<!--android:id="@+id/detail"-->
<!--android:name="<package>.<fragment_name>"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent" />-->
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
但我想淡化整个相对布局,因为我向上滚动它应该开始褪色(平均整个折叠栏布局).它确实在特定点淡出,但我希望它在我向上滚动时淡出.谢谢,任何帮助表示赞赏.
我正在研究填字游戏算法来开发一个文字应用程序。经过大量谷歌搜索或在 StackOverflow 上搜索后,我终于达到了这一点。但我还无法理解 Java 中算法的正确实现。下面是我使用的类。
public class Crosswords {
char[][] cross;
int rows;
int cols;
char[][] numberGrid;
boolean startword;
final char DEFAULT = ' ';
public Crosswords() {
rows = 50;
cols = 50;
cross = new char[rows][cols];
numberGrid = new char [rows][cols];
for (int i = 0; i < cross.length;i++){
for (int j = 0; j < cross[i].length;j++){
cross[i][j] = DEFAULT;
}
}
}
public Crosswords(int ros, int colls) {
rows = ros;
cols = colls;
cross = new …Run Code Online (Sandbox Code Playgroud) 我正在实施谷歌加一个按钮,当我点击+1按钮,然后在弹出时单击确定它工作正常.但是当我单击UNDO按钮时,+1按钮变灰.如果我从设置中清除应用程序数据而不是它开始正常工作,否则+1按钮保持灰色.这是一些错误还是有一些解决这个问题的方法?以下是我正在使用的代码.
在onCreate:
mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
mPlusOneButton.setOnPlusOneClickListener(new PlusOneButton.OnPlusOneClickListener() {
@Override
public void onPlusOneClick(Intent intent) {
try {
startActivityForResult(intent, 0);
}catch (NullPointerException e){
}
}
});
Run Code Online (Sandbox Code Playgroud)
在onResume:
mPlusOneButton.initialize(URL, PLUS_ONE_REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)
和:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == -1) {
// OK or SHARE
System.out.println("OK or SHARE");
mPlusOneButton.setIntent(null);
} else {
//UNDO
System.out.println("UNDO");
}
}
Run Code Online (Sandbox Code Playgroud) 我正在开发地图应用程序,我从我的服务器获取地点的坐标,我正在调用 API,它使用 mMap.setOnCameraIdleListener. 问题是每次我移动相机时都会调用 API,如果用户只是稍微移动了地图相机,则标记会一次又一次地设置在相同的位置。
现在,我想检查可见区域上的标记数量,但我不知道如何仅计算可见区域上的标记数量。我使用了下面的代码,但它只能告诉我一个特定LatLng点是否在可见区域可见。
public boolean isVisibleOnMap(LatLng latLng) {
VisibleRegion vr = mMap.getProjection().getVisibleRegion();
return vr.latLngBounds.contains(latLng);
}
Run Code Online (Sandbox Code Playgroud) android ×4
algorithm ×1
android-collapsingtoolbarlayout ×1
crossword ×1
google-maps ×1
java ×1
xml ×1