\n\n\n我收到 image\xc2\xb4s 错误,但我不明白 \xc2\xb4t 为什么会收到它。\n还附上了第二张图片中的目录。
\n
import Link from \'next/link\';\nimport { useState } from \'react\';\nimport { ProductModel } from \'../models/product\';\nimport { CardProduct } from \'../components/CardProduct\';\n\nconst List = () => {\n\n let list: ProductModel[] = [ //ProductModel[] esto significa que va a ser un array de ProductModel\n {\n id: 1,\n name: "shoes",\n price: 9999,\n },\n ];\n\n const [products, setProducts] = useState<ProductModel[]>(list);\n\n return (\n <div>\n Soy la p\xc3\xa1gina de Productos\n {products.map((element, index) => {\n return <CardProduct product={element}/>;\n })}\n <br/>\n …Run Code Online (Sandbox Code Playgroud) 我正在尝试将OneSignal集成到我的Angular 2应用程序中以接收推送通知.首先,我使用普通的旧HTML做了一个HelloWorld应用程序,它运行得很漂亮.所以我试着将它包含在我的Angular应用程序中,但用户没有被创建/注册,因此没有订阅接收任何通知.
代码摘录:
的index.html
<html>
<head>
<meta charset="utf-8">
<title>My Angular App</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<head>
<link rel="manifest" href="/manifest.json">
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async></script>
<script>
var OneSignal = window.OneSignal || [];
console.log("Init OneSignal");
OneSignal.push(["init", {
appId: "xxx-xxx-xxx-xxx-xxx",
autoRegister: false,
allowLocalhostAsSecureOrigin: true,
notifyButton: {
enable: true
}
}]);
console.log('OneSignal Initialized');
OneSignal.push(function () {
console.log('Registered For Push');
OneSignal.getUserId().then(function (userId) {
console.log("User ID is", userId);
});
});
</script>
</head>
</head>
<body>
<app-root>
<div class="wrap">
<div class="loading outer">
<div class="loading …Run Code Online (Sandbox Code Playgroud) 我正试图在ViewPager内部的片段内的Android设计支持库中获取一个浮动操作按钮.我有4个选项卡,我只想在其中一个选项卡中使用FAB.我的布局如下:
main_layout.xml
<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/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
app:tabIndicatorHeight="3dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
Run Code Online (Sandbox Code Playgroud)
list_fragment_with_fab.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="5dip"
android:background="@color/Transparent_White"
android:fitsSystemWindows="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
<org.lucasr.twowayview.widget.TwoWayView
android:id="@+id/clip_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:twowayview_layoutManager="ListLayoutManager" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/add_list_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@drawable/ic_list_add"
app:layout_anchor="@+id/clip_recycler_view"
app:layout_anchorGravity="bottom|right|end" />
Run Code Online (Sandbox Code Playgroud)
现在的问题是,FAB不能按照设计规范工作.即隐藏和展示工厂不起作用.此外,当激活片段时,FAB不在其初始位置.我在下面附上了截图,以便更清楚.
如您所见,在左侧图像中,FAB不在屏幕上.当我滚动时,工具栏将隐藏(想想Play商店应用程序)并且标签保持不变,那时FAB将向上滚动.

这是设计支持库中的错误吗?或者我的布局不正确?此外,我只想在其中一个片段中使用FAB,因此添加main_layout.xml有点会失败.
android android-fragments android-viewpager floating-action-button android-coordinatorlayout
我正在尝试在TextView/EditText中格式化Hashtags(比如Material Design Specs中提到的Chips).我可以使用格式化背景ReplacementSpan.但问题是我无法增加TextView/EditText中的行间距.见下图

问题是如何为主题标签添加顶部和底部边距?
这是我在文本中添加背景的代码:
/**
* First draw a rectangle
* Then draw text on top
*/
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) {
RectF rect = new RectF(x, top, x + measureText(paint, text, start, end), bottom);
paint.setColor(backgroundColor);
canvas.drawRoundRect(rect, CORNER_RADIUS, CORNER_RADIUS, paint);
paint.setColor(textColor);
canvas.drawText(text, start, end, x, y, paint);
}
Run Code Online (Sandbox Code Playgroud) 我有一个自定义导航抽屉与几个TextViews.这是布局:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<LinearLayout
android:layout_width="240dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/White"
android:layout_gravity="start">
<TextView
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:textStyle="bold|italic"
android:gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="First Item" />
<View
android:layout_width="fill_parent"
android:layout_height="3dp"
android:background="@color/gplus_color_1" />
<TextView
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:text="Second Item"
android:gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:id="@+id/second" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
问题是,如果我不指定任何onClick()的TextView,然后使触摸反映在ListView它的背景.说,第二次TextView我分配了一个onClick监听器,但是对于第一个TextView我没有,当我触摸第一个时TextView,抽屉后面的列表项被选中但不是第二个.打开抽屉时,如何将注意力集中在导航抽屉物品上?
我有一个自定义ArrayList,并希望将其转换为CharSequence [].
我试过这个
List<String> list = Arrays.asList("foo", "bar", "waa");
CharSequence[] cs = list.toArray(new CharSequence[list.size()]);
System.out.println(Arrays.toString(cs)); // [foo, bar, waa]
Run Code Online (Sandbox Code Playgroud)
但它只适用于字符串类型.
android ×4
typescript ×2
angular ×1
angular-cli ×1
arraylist ×1
charsequence ×1
hashtag ×1
java ×1
listview ×1
next.js ×1
onesignal ×1
react-native ×1
reactjs ×1