小编Sri*_*vas的帖子

如何在android中保存listview并在需要时将其取回?

我有一个包含三个字段的listview,但我不知道如何保存我的listview android并在用户打开应用程序并将其显示时将其取回.

我想显示listview中保存的数据,我必须保存用户输入列表视图的新数据.

android android-networking android-listview android-sqlite

7
推荐指数
1
解决办法
1010
查看次数

NestedScrollView 中的 CardView 自动增加高度 [包含图像]

我正在嵌套滚动视图中添加卡片。对于 LinearLayout 中顺序较低的卡片,卡片高度会自动增加。要了解该问题,请注意第一张卡片和最后一张卡片之间的卡片高度。尽管卡片相同,但最后一张卡片的阴影比第一张卡片的阴影更深。如何解决?

使用 appcompat v7:22.+ 作为 v7 库的依赖项。

这是我的卡片视图布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    card_view:cardElevation="1dp"
    android:layout_marginBottom="10dp"
    card_view:cardUseCompatPadding="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_margin="10dp"
            xmlns:android="http://schemas.android.com/apk/res/android">

            <TextView
                android:id="@+id/hint"
                android:layout_width="0dp"
                android:text="ABC"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:textColor="@color/textHint"/>
            <TextView
                android:id="@+id/description"
                android:layout_width="0dp"
                android:text="DEFG BHJHKJ"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_weight="1"/>
        </LinearLayout>

</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)

这就是我使用卡片视图的方式:

<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:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingtoolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleTextAppearance="@android:color/transparent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <include
                layout="@layout/shared_activity_item"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_collapseMode="parallax" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:contentInsetStart="0dp"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> …
Run Code Online (Sandbox Code Playgroud)

android android-scrollview android-cardview android-elevation nestedscrollview

5
推荐指数
0
解决办法
1598
查看次数

使用reportlab python模块将泰米尔语字符写入PDF?

我有一个UTF-8编码的文件,其中的内容为泰米尔语(印度语言)。我必须阅读文件的内容并制作PDF。我正在使用reportlab python模块来执行此操作。

我能够打开文件并阅读内容,并将其打印到终端上,可以完美显示内容。但是,当使用reportlab将内容写入PDF时,某些字符(由两个“字符符号”组成的复合字符在复合字符中的顺序相反)。我为reportlab段落样式设置了泰米尔字体。我缺少什么?

from reportlab.pdfbase import pdfmetrics
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import inch
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.pdfbase.ttfonts import TTFont
pdfmetrics.registerFont(TTFont('Latha', '/home/srinivas/Fonts/latha/latha.ttf'))
from os import listdir
from os.path import isdir, isfile, join
import random
import codecs
from tamil import utf8 as tamil
PATH = 'tamil_file'
num_sets = 1
pages_per_set = 12
num_articles_per_page = 2

styles = getSampleStyleSheet()
styles.add(ParagraphStyle(name='CustomPara', fontName='Mangal', fontSize=14, alignment=TA_JUSTIFY, leading=24))

style = styles['CustomPara'] …
Run Code Online (Sandbox Code Playgroud)

python pdf unicode reportlab tamil

5
推荐指数
0
解决办法
320
查看次数

向右浮动 android

无法使线性布局中的视图向右浮动。下面是我的代码。如果layout_gravity将视图与其父视图对齐,那么第三个视图(下面代码中的第二个ImageView)应该在右侧,但事实并非如此。如何解决这个问题?

<LinearLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#456abc"
android:gravity="center"
android:orientation="horizontal">

<ImageView
    android:id="@+id/left"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@mipmap/arrow_down" />

<TextView
    android:id="@+id/info"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="ABDEF" />

<ImageView
    android:id="@+id/right"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:src="@mipmap/arrow_right" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout android-linearlayout android-view

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