Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Change native android selection handles
Forum Updated to NodeBB v4.3 + New Features

Change native android selection handles

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Schluchti
    wrote on last edited by
    #1

    Hi,

    as of Qt 5.8, it's now possible to select text with the native android selection handles. (see https://codereview.qt-project.org/#/c/142466/ ). Now I would like to exchange the default Android selection handles

    alt text alt text
    alt text

    with the material design selection handles. Therefore, I copied the material design selection handles to my drawablefolder and created a custom apptheme.xml with the following content:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="AppTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
            <item name="android:textSelectHandle">@drawable/text_select_handle_middle</item>
            <item name="android:textSelectHandleLeft">@drawable/text_select_handle_left</item>
            <item name="android:textSelectHandleRight">@drawable/text_select_handle_right</item>
        </style>
    </resources>
    

    In my AndroidManifest.xml I reference the custom style with

    <application
            ...
            android:theme="@style/AppTheme">
            ...
    </application>
    

    However, the style of the selection handles doesn't change. Anybody an idea what I am doing wrong?

    Want to read more about Qt?

    https://gympulsr.com/blog/qt/

    Latest Article: https://gympulsr.com/blog/qt/2017/06/14/ios-background-music-qt.html

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mannol
      wrote on last edited by
      #2

      Just encountered a same issue myself and manage to stumble upon a solution after a long period of searching barely documented android docs. Anyways, for some reason, the theme is not read from the AndroidManifext.xml, not in this case anyways. So to solve it, you have to manually load your theme file in Activity's onCreate() method like so:

      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setTheme(R.style.AppTheme);
          // rest of the code ...
      }
      
      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved