小编iap*_*ker的帖子

根据设备的大小增加字体大小

我计划在不同的设备大小上为textview使用不同的字体大小,以使字母清晰可辨.我已经决定不为不同的设备使用不同的布局,并构建了一个适合所有设备的通用布局.现在唯一的问题是文本大小.

问题:

  1. 我想就如何根据设备的大小(物理尺寸)改变字体大小提出技术建议.

  2. 如何根据宽高比导出字体大小.

  3. 使用这种方法有什么缺陷吗?

Xml用于文本视图

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffff"
    android:orientation="vertical">

    <TextView
        android:id="@+id/tvValue4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="I planned to use different font size for the textview on different device size so as to make the letters legible. I have already decided not to use different layouts for different devices and built a common layout to fit in all the devices. Now the only problem is on the text size."
        android:textColor="#000000"
        android:textSize="15sp" />

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

提前致谢

android textview

25
推荐指数
4
解决办法
6万
查看次数

将Google Play中的Android应用转换为三星商店

最近(7月1日之后),我在Google Play中推出了一款新应用.但我知道从7月1日起,三星不会接受不使用三星SDK的应用程序.

虽然我不需要三星SDK中的任何特殊功能,但它们迫使我使用它.我必须利用三星商店的用户群.什么是让我的应用程序与三星商店兼容的简单方法.分享您的经验.

我们可以简单地使用SDK而不实现任何功能吗?

提前致谢 !在此输入图像描述

在此输入图像描述

android publishing apk google-play-services samsung-mobile-sdk

22
推荐指数
1
解决办法
8460
查看次数

Android布局 - 布局量和权重

我需要使用一组线性布局构建布局.布局必须占据屏幕的定义百分比.我需要这样做才能在所有设备上看到类似的外观.

问题:

我在右上角的布局中有一个textview(绿色框).每当我在textview中添加一些数据时,它会扰乱整个布局,如下图所示.但是当我到达屏幕/布局的右端时,我需要自动包装数据.

请帮我解决这个问题.提前致谢

Image1 - 根据下面显示的XML的图形视图

在此输入图像描述

Image2 - 当我在textView中添加一些数据时,显示布局如何自动更改

在此输入图像描述

XML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" 
android:weightSum="100">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:layout_weight="91"
    android:weightSum="100">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:orientation="vertical" 
                        android:layout_weight="40"
                        android:weightSum="235">

                                                    <LinearLayout
                                                        android:layout_width="match_parent"
                                                        android:layout_height="match_parent" 
                                                        android:orientation="vertical"  
                                                        android:gravity="center"
                                                        android:background="#ff0000"
                                                        android:layout_weight="100">

                                                                                    <TextView
                                                                                        android:id="@+id/textView1"
                                                                                        android:layout_width="wrap_content"
                                                                                        android:layout_height="wrap_content"
                                                                                        android:textColor="#000000" />

                                                    </LinearLayout>

                                                    <LinearLayout
                                                        android:layout_width="match_parent"
                                                        android:layout_height="match_parent" 
                                                        android:orientation="vertical"   
                                                        android:background="#ffff00"
                                                        android:layout_weight="45">   



                                                                                    <ViewFlipper
                                                                                        android:id="@+id/view_flipper"
                                                                                        android:layout_width="match_parent"
                                                                                        android:layout_height="match_parent"
                                                                                        android:layout_below="@+id/tvItemName" >


                                                                                                                        <LinearLayout
                                                                                                                            android:layout_width="match_parent"
                                                                                                                            android:layout_height="match_parent"
                                                                                                                            android:orientation="vertical" >
                                                                                        </LinearLayout>
                                                                                     </ViewFlipper>



                                                    </LinearLayout>

                                                    <LinearLayout
                                                        android:layout_width="match_parent"
                                                        android:layout_height="match_parent" 
                                                        android:orientation="vertical"  
                                                        android:background="#ffffff"
                                                        android:layout_weight="90">   


                                                    </LinearLayout> 

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:orientation="vertical" 
                        android:layout_weight="60"
                        android:weightSum="100">

                                                    <LinearLayout
                                                        android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

android textview android-layout android-listfragment

11
推荐指数
2
解决办法
3万
查看次数

悬挂应用程序的多个异步任务

在我的Android应用程序中,我使用THREAD_POOL_EXECUTOR使用多个AsyncTask,这使得任务并行运行.有时应用程序挂起.以下是我使用的代码.

  1. 你能告诉我如何微调以避免任何悬挂问题吗?
  2. 如何找到应用程序挂起的点?

    new fetchInitialCoinsParallel().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url);
    
    prefCoinList = getPrefCoin();
    if(prefCoinList.size()>0){
        for(int i=0;i<prefCoinList.size();i++){
            new fetchAltCoinsParallel().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url);
        }
    }
    
    public class fetchAltCoinsParallel extends AsyncTask<String, String, String> {
    @Override
    protected void onPreExecute() {
    }
    
    protected String doInBackground(String... params) {
        try {
            InputStream is = getDataFromURL(params[0]);
            if(is!=null){
                BufferedReader br = new BufferedReader(new InputStreamReader(is));
                synchronized(this){
                    brList.add(br);
                }
    
            }else{
                prefCoinNotLoadedTimeOutCount=prefCoinNotLoadedTimeOutCount+1;
            }
    
    
            if(brList.size()==prefCoinList.size()-prefCoinNotLoadedTimeOutCount){
                try {
                    loadAltCoins(getAltCoinDataParallel());
                } catch (IOException e) {
                    e.printStackTrace();
                }
    
                maingame.dataReady=true;
            }
    
        } catch (IOException e) {
            e.printStackTrace();
        } 
        return null;
    }
    
    protected void …
    Run Code Online (Sandbox Code Playgroud)

android android-asynctask threadpoolexecutor

11
推荐指数
1
解决办法
616
查看次数

在Admob中奖励视频广告 - 调解无效

从我的Admob,我已经设置了Flurry和Vungle的调解.当我请求广告时,我总是收到Logcat中提供的错误.

Could not instantiate mediation adapter: com.google.ads.mediation.flurry.FlurryAdapter.
MediationAdapter is not a MediationRewardedVideoAdAdapter: com.vungle.mediation.VungleInterstitialAdapter
Run Code Online (Sandbox Code Playgroud)

代码参考

摇篮

dependencies {

compile files('libs/FlurryAnalytics-6.2.0.jar')
compile files('libs/FlurryAds-6.2.0.jar')
compile files('libs/flurryAndroidDFPandAdMobMediationAdapter-5.0.0.r1.jar')
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/vungle-publisher-adaptive-id-3.3.4.jar')
compile files('libs/VungleAdapter.jar')

compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services-ads:8.3.+'
compile 'com.google.android.gms:play-services-analytics:8.3.+'
compile 'com.google.android.gms:play-services-appindexing:8.3.+'
compile 'com.google.android.gms:play-services-appinvite:8.3.+'
compile 'com.google.android.gms:play-services-games:8.3.+'
compile 'com.google.android.gms:play-services-identity:8.3.+'
compile 'com.google.android.gms:play-services-plus:8.3.+'
compile project(':BaseGameUtils')
compile project(':facebook-android-sdk-4.8.1')
compile files('libs/AudienceNetwork.jar')
compile files('libs/FacebookAdapter.jar')
}
Run Code Online (Sandbox Code Playgroud)

Admob设置

我已在Admob中设置adunit,Adtype为非页内广告,如下所示在此输入图像描述

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}
@Override
protected void onPause() {
    super.onPause();
    if(rewardedVideoAd!= null)
        rewardedVideoAd.pause();
    socialShareType=null; …
Run Code Online (Sandbox Code Playgroud)

android interstitial admob flurry vungle-ads

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

编辑不在JAVA>安全下的站点列表

我需要在"编辑站点列表"下的"例外站点列表"中添加一些URL.但我没有在我的开始>控制面板> JAVA>安全性上找到它.

在此输入图像描述

java

9
推荐指数
1
解决办法
3万
查看次数

在Android应用中添加Firebase Analytics和Google Analytics

我已经实施了Firebase Analytics.它工作正常.我也希望使用Google Analytics.基于此处的讨论,我在google-services.json中包含了以下对象

"analytics_service": {
      "status": 2,
      "analytics_property": {
        "tracking_id": "<your tracking id>"
      }
    },
Run Code Online (Sandbox Code Playgroud)

对于Google Analytics,我有跟踪器类

public class PuzzleGamesTracker extends Application {

// The following line should be changed to include the correct property id.
private static final String PROPERTY_ID = "<your tracking id>";

private Tracker mTracker;


@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

/**
 * Gets the default {@link Tracker} for this {@link Application}.
 * @return tracker
 */
synchronized public Tracker getDefaultTracker() …
Run Code Online (Sandbox Code Playgroud)

android google-analytics google-analytics-api firebase firebase-analytics

9
推荐指数
1
解决办法
2577
查看次数

使用Libgdx为64位设备更新Android应用程序

我在谷歌播放的android中有一些应用程序.我只需根据谷歌最近提到的以下要求更新应用程序.即,所有应用程序必须与64位兼容.

https://android-developers.googleblog.com/2019/01/get-your-apps-ready-for-64-bit.html

问题:

  1. 应用程序需要更改哪些代码才能使其与64位设备兼容?
  2. 我们有64位版本的LibGdx吗?
  3. 如果没有可用的64位LibGdx,还有其他解决方法吗?

android libgdx android-studio

8
推荐指数
1
解决办法
1280
查看次数

在Android中无摩擦的Facebook分享

用户每次完成一个级别时都必须单击共享对话框中的帖子按钮.我需要为用户消除这种困难.截至目前,我已经创建了一个自定义故事,并要求用户每次都点击发布.

题 :

  1. 我听说Open图形故事的无摩擦FB帖子.在android中有可能吗?

  2. 如果在android中有可用的无摩擦FB帖子,请指点我在下面粘贴的代码中的更正.

  3. 如果android中有无摩擦FB帖子,我需要从用户那里得到什么许可?

    ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
            .putString("og:type", "puzzlegameballmania:level")
            .putString("og:title", "Cleared Level-1 !!!")
            .putString("og:image", "http://ixxxxwsz.jpg")
            .putString("og:url", "https://play.google.com/store/apps/details?id=com.gamxxxxx.android")
            .putString("og:description", "Color of the balls matters more. Lets break the goal and go higher !")
            .putString("puzzlegameballmania:level:title", "LEVEL 1")
            .build();

    // Create an action
    ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
            .setActionType("puzzlegameballmania:clear")
            .putObject("puzzlegameballmania:level", object)
            .build();

    // Create the content
    ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
            .setPreviewPropertyName("puzzlegameballmania:level")
            .setAction(action) 
            .build();

    ShareDialog.show(AndroidLauncher.this, content);
Run Code Online (Sandbox Code Playgroud)

android facebook-graph-api facebook-android-sdk facebook-opengraph facebook-share

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

Android studio问题:无法找到广告:AdQuality:未指定

我更新了Android工作室并刚刚打开我的项目,我收到以下错误.你能告诉我怎么解决这个问题吗?

Error:A problem occurred configuring project ':memoryGameCollectionFree'.
> Could not resolve all dependencies for configuration     ':memoryGameCollectionFree:_debugCompile'.
   > Could not find ads:AdQuality:unspecified.
 Searched in the following locations:
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/ads/AdQuality/unspecified/AdQuality-unspecified.pom
     file:/C:/Program Files/Android/Android Studio/gradle/m2repository/ads/AdQuality/unspecified/AdQuality-unspecified.jar
     https://jcenter.bintray.com/ads/AdQuality/unspecified/AdQuality-unspecified.pom
     https://jcenter.bintray.com/ads/AdQuality/unspecified/AdQuality-unspecified.jar
     https://repo1.maven.org/maven2/ads/AdQuality/unspecified/AdQuality-unspecified.pom
     https://repo1.maven.org/maven2/ads/AdQuality/unspecified/AdQuality-unspecified.jar
     file:/C:/Users/Sudhakar/AppData/Local/Android/sdk/extras/android/m2repository/ads/AdQuality/unspecified/AdQuality-unspecified.pom
     file:/C:/Users/Sudhakar/AppData/Local/Android/sdk/extras/android/m2repository/ads/AdQuality/unspecified/AdQuality-unspecified.jar
     file:/C:/Users/Sudhakar/AppData/Local/Android/sdk/extras/google/m2repository/ads/AdQuality/unspecified/AdQuality-unspecified.pom
     file:/C:/Users/Sudhakar/AppData/Local/Android/sdk/extras/google/m2repository/ads/AdQuality/unspecified/AdQuality-unspecified.jar
 Required by:
     MemoryGameCollectionFree:memoryGameCollectionFree:unspecified > com.facebook.android:audience-network-sdk:4.12.0
Run Code Online (Sandbox Code Playgroud)

android facebook-android-sdk android-studio facebook-sdk-4.0 facebook-audience-network

6
推荐指数
2
解决办法
1278
查看次数