小编DMI*_*DMI的帖子

如何在apache2中禁用mod_deflate?

如何在Apache2中禁用mod_deflate

  • 对于特定目录中的文件

要么

  • 对于所有扩展名为.py的文件?

apache mod-deflate apache2

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

Android:单击TextView中的特定单词时显示弹出对话框

在我的申请中,我有一些条款和条件的文本.

注册即表示您同意遵守我们的使用条款,并且您已阅读我们的隐私政策.

这句话使用条款隐私权政策应该是点击,并显示一个警告框.

首先,我尝试将句子分成四个TextView:

  1. 注册即表示您同意接受我们的约束
  2. 使用条款
  3. 并且你已经阅读了我们的
  4. 隐私政策.

这很好用,具有以下布局XML:

 <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/termsandcondtion"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:orientation="horizontal" >

        <TextView
            android:id="@+id/terms_1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/terms_1"
            android:textColor="#000000"
            android:textSize="12dp" />

        <TextView
            android:id="@+id/terms"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:onClick="showTerms"
            android:text="@string/terms_2"
            android:textColor="#000000"
            android:textSize="12dp" />

        <TextView
            android:id="@+id/terms_3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/terms_3"
            android:textColor="#000000"
            android:textSize="12dp" />

        <TextView
            android:id="@+id/termsofuse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            android:onClick="showTermsofUse"
            android:text="@string/terms_4"
            android:textColor="#000000"
            android:textSize="12dp" />
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

显示弹出窗口的代码是:

WebView wv = new WebView(this);

    wv.loadUrl(url);

    wv.setWebViewClient(new WebViewClient()
    {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            view.loadUrl(url); …
Run Code Online (Sandbox Code Playgroud)

android textview android-widget android-layout

6
推荐指数
1
解决办法
2712
查看次数

在制作按钮时,奇怪的工件看起来像API 21中的Spinners

我有一个应用程序,我正在使用Android支持库更新为Material Design样式.在应用程序中,我有一些实际上是Buttons的元素,但样式看起来像Spinners.单击时,它们会弹出日期或时间选择器,并在选择完成后更新文本.

创建这些元素的布局XML片段是:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <Button
        android:id="@+id/start_date"
        style="?android:attr/spinnerStyle"
        android:layout_width="0dp"
        android:layout_weight="3"
        android:hint="@string/hint_start_date"
        android:layout_height="wrap_content"/>

    <Button
        android:id="@+id/start_time"
        style="?android:attr/spinnerStyle"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"/>

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <Button
        android:id="@+id/end_date"
        style="?android:attr/spinnerStyle"
        android:hint="@string/hint_end_date"
        android:layout_width="0dp"
        android:layout_weight="3"
        android:layout_height="wrap_content"/>

    <Button
        android:id="@+id/end_time"
        style="?android:attr/spinnerStyle"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这与以前的版本相比没有变化,它可以正常工作.从棒棒糖开始,不是像我期望的那样渲染,而是出现一个奇怪的灰色边框(例如在Nexus 6上):

我在设备上看到的内容

当按压并保持元件时,内部形状的底部收缩,因此灰色三角形变宽.

我已经尝试重写该样式以使用我自己的(略微修改过的)原始AppCompat Library drawables的副本作为背景.我试图强制背景@null,并且工件仍在那里.Android Studio中呈现的预览在元素的左侧显示灰色边框,我也无法删除:

Android Studio中的怪异

我真的不知道这是从哪里来的.有什么建议?或者也许想要使用不同的UI模式?

  • 测试设备:Nexus 6,Android 5.0
  • Android studio版本:1.0.2
  • 构建工具版本:21.1.2
  • AppCompat-v7库版本:21.0.3
  • 编译SDK版本:21
  • 最低SDK版本:15
  • 目标SDK版本:21

android android-layout android-support-library material-design android-5.0-lollipop

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

使用优先级聚合SQL行

我有一张桌子,里面摆满了不同来源的物品.一些来源可能具有相同的位置(在我的示例中,不同的BBC新闻源将是不同的来源,但它们都来自BBC).每个项目都有一个"唯一"ID,可用于从同一位置识别它.这意味着与网站上相同新闻报道相关但在不同Feed下发布的项目将具有相同的"唯一ID",但这不一定是全球唯一的.

问题是我希望在显示时删除重复项,以便(根据您看到的哪些Feed)您最多只能获得每个故事的一个版本,即使您的两个或三个Feed可能包含指向它的链接.

我有一个sources表格,其中包含有关每个来源location_idlocation_precedence字段的信息.然后,我有一个items包含每个项目,它的表unique_id,source_idcontent.具有相同unique_id和来源的项目location_id最多应出现一次,最高来源location_precedence获胜.

我原以为是这样的:

SELECT `sources`.`name` AS `source`,
       `items`.`content`,
       `items`.`published`
FROM `items` INNER JOIN `sources`
  ON `items`.`source_id` = `sources`.`id` AND `sources`.`active` = 1
GROUP BY `items`.`unique_id`, `sources`.`location_id`
ORDER BY `sources`.`location_priority` DESC
Run Code Online (Sandbox Code Playgroud)

会做的伎俩,但似乎忽略了位置优先级字段.我错过了什么?


示例数据:

CREATE TABLE IF NOT EXISTS `sources` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `location_id` int(10) unsigned NOT NULL,
  `location_priority` int(11) NOT NULL,
  `active` tinyint(1) unsigned NOT NULL …
Run Code Online (Sandbox Code Playgroud)

mysql sql group-by aggregation

0
推荐指数
1
解决办法
2349
查看次数