Saturday, February 22, 2014

Prohibit pictures automatically scaling issues


Wrote a page with ViewPager to implement a sliding code (also from the Internet seems to code yourself under slightly modified), but the picture on the ImageView will automatically zoom (image size no container so big), do not know what way does Let the picture to enlarge it?
Details can be found as follows:

XML resource file
Main resource file:
activity_main.xml:
  

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: id = "@ + id / viewGroup"
android: layout_width = "fill_parent"
android: layout_height = "20dp"
android: gravity = "center_horizontal"
android: orientation = "horizontal">


<- Android:! Layout_marginBottom = "30dp" ->

android: id = "@ + id / viewPager"
android: layout_width = "fill_parent"
android: layout_height = "wrap_content" />



item1.xml, item2.xml, item3.xml, item4.xml, item5.xml, item6.xml are the same, huh:
  

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: orientation = "vertical">

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: gravity = "center_horizontal"
android: background = "@ drawable/guide01">


<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Code:
 package com.example.myfirstapp; 

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.widget.ImageView;

public class MainActivity extends Activity {
ViewPager viewPager;
ArrayList list;
ViewGroup main, group;
ImageView imageView;
ImageView [] imageViews;

@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
this.requestWindowFeature (Window.FEATURE_NO_TITLE);
LayoutInflater inflater = getLayoutInflater ();
list = new ArrayList ();
list.add (inflater.inflate (R.layout.item1, null));
list.add (inflater.inflate (R.layout.item2, null));
list.add (inflater.inflate (R.layout.item3, null));
list.add (inflater.inflate (R.layout.item4, null));
list.add (inflater.inflate (R.layout.item5, null));
list.add (inflater.inflate (R.layout.item6, null));

imageViews = new ImageView [list.size ()];
ViewGroup main = (ViewGroup) inflater.inflate (R.layout.activity_at_games_launcher, null);
ViewGroup group = (ViewGroup) main.findViewById (R.id.viewGroup);
viewPager = (ViewPager) main.findViewById (R.id.viewPager);

for (int i = 0; i imageView = new ImageView (MainActivity.this);
/ / ImageView.setLayoutParams (new LayoutParams (10,10));
/ / ImageView.setPadding (10, 0, 10, 0);
imageViews [i] = imageView;
if (i == 0) {
imageViews [i] setBackgroundResource (R.drawable.page_indicator_focused);.
} Else {
imageViews [i] setBackgroundResource (R.drawable.page_indicator);.
}
group.addView (imageView);
}

setContentView (main);

viewPager.setAdapter (new MyAdapter ());
viewPager.setOnPageChangeListener (new MyListener ());
}

class MyAdapter extends PagerAdapter {

@ Override
public int getCount () {
return list.size ();
}

@ Override
public boolean isViewFromObject (View arg0, Object arg1) {
return arg0 == arg1;
}

@ Override
public int getItemPosition (Object object) {
/ / TODO Auto-generated method stub
return super.getItemPosition (object);
}

@ Override
public void destroyItem (View arg0, int arg1, Object arg2) {
/ / TODO Auto-generated method stub
((ViewPager) arg0) removeView (list.get (arg1));.
}

@ Override
public Object instantiateItem (View arg0, int arg1) {
/ / TODO Auto-generated method stub
((ViewPager) arg0) addView (list.get (arg1));.
return list.get (arg1);
}

@ Override
public void restoreState (Parcelable arg0, ClassLoader arg1) {
/ / TODO Auto-generated method stub

}

@ Override
public Parcelable saveState () {
/ / TODO Auto-generated method stub
return null;
}

@ Override
public void startUpdate (View arg0) {
/ / TODO Auto-generated method stub

}

@ Override
public void finishUpdate (View arg0) {
/ / TODO Auto-generated method stub

}
}

class MyListener implements OnPageChangeListener {

@ Override
public void onPageScrollStateChanged (int arg0) {
/ / TODO Auto-generated method stub

}

@ Override
public void onPageScrolled (int arg0, float arg1, int arg2) {
/ / TODO Auto-generated method stub

}

@ Override
public void onPageSelected (int arg0) {
for (int i = 0; i imageViews [arg0] setBackgroundResource (R.drawable.page_indicator_focused);.
if (arg0! = i) {
imageViews [i] setBackgroundResource (R.drawable.page_indicator);.
}
}

}

}
}

Reply:
Supplement:
ImageView on item1 ~ 6.xml in the picture than the screen size is small, it will be enlarged to each display screen size, I do not want it to zoom in, how to operate?
Please prawn wing!
Reply:
Get their own, huh.
Item1 ~ 6.xml adjusted for the following:
 xml version = "1.0" encoding = "utf-8"?> 

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: gravity = "center"
android: orientation = "vertical">

android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: background = "@ drawable/guide01">




In addition, the picture folder from drawable-hdpi move to drawable file.
Reply:
The reply was deleted administrator at 2013-10-27 17:16:09

Reply:
previous question has been resolved, but it did not return stickers, points to not go out, just have a question, by the way here to ask.
No way, the available points less, save point with ah

Now the new question is, how to call Google App Store (Play Store) applications inside their own program?
I put the system to install apk package name are printed out, does not seem, much to ask you, how to get it?
Reply:
Brothers, give suggestions, ah, do not let it sink so fast ah! ! !
Reply:
Brothers, do not let the posts Shen ah, support
Reply:
Determining system app store application do?
Reply:
Determined to be there, because there may be clicking into the system Launcher application interface.

But the strange thing is, I installed the system in a little package printing as:
 android 
android.rk.RockVideoPlayer
android.rockchip.update.service
com.DeviceTest
com.adobe.flashplayer
com.android.Win8Widget
com.android.apkinstaller
com.android.backupconfirm
com.android.bluetooth
com.android.browser
com.android.calculator2
com.android.calendar
com.android.certinstaller
com.android.chrome
com.android.contacts
com.android.defcontainer
com.android.deskclock
com.android.email
com.android.exchange
com.android.facelock
com.android.galaxy4
com.android.gallery3d
com.android.htmlviewer
com.android.inputdevices
com.android.inputmethod.latin
com.android.inputmethod.pinyin
com.android.keychain
com.android.launcher
com.android.magicsmoke
com.android.music
com.android.musicfx
com.android.musicvis
com.android.noisefield
com.android.packageinstaller
com.android.phasebeam
com.android.phone
com.android.providers.applications
com.android.providers.calendar
com.android.providers.contacts
com.android.providers.downloads
com.android.providers.downloads.ui
com.android.providers.drm
com.android.providers.media
com.android.providers.partnerbookmarks
com.android.providers.settings
com.android.providers.telephony
com.android.providers.userdictionary
com.android.provision
com.android.quicksearchbox
com.android.rk
com.android.rk.mediafloat
com.android.rockchip.wallpaper
com.android.settings
com.android.sharedstoragebackup
com.android.smspush
com.android.soundrecorder
com.android.systemui
com.android.vending
com.android.videoeditor
com.android.vpndialogs
com.android.wallpaper
com.android.wallpaper.holospiral
com.android.wallpaper.livepicker
com.atgames.genesis
com.atgames.menu.cloud
com.atgames.menu.hal
com.atgames.menu.help
com.atgames.sms
com.example.atgameslauncher
com.example.guge
com.google.android.apps.maps
com.google.android.apps.uploader
com.google.android.backup
com.google.android.ears
com.google.android.feedback
com.google.android.gm
com.google.android.gms
com.google.android.googlequicksearchbox
com.google.android.gsf
com.google.android.gsf.login
com.google.android.location
com.google.android.marvin.talkback
com.google.android.onetimeinitializer
com.google.android.partnersetup
com.google.android.setupwizard
com.google.android.street
com.google.android.syncadapters.bookmarks
com.google.android.syncadapters.calendar
com.google.android.syncadapters.contacts
com.google.android.talk
com.google.android.tts
com.google.android.voicesearch
com.ijinshan.ShouJiKong.AndroidDaemon
com.livecirrus.newsportal
com.qihoo.appstore
com.svox.pico
jp.co.omronsoft.openwnn

Play Store but did not find the package name.

I cited the system package code below:
 private void getPackageInfos () {
mPackageManager = getPackageManager ();
mPackageInfoList = mPackageManager.getInstalledPackages (0);
}

private void showPackageInfos () {
for (int i = 0; i PackageInfo pi = (PackageInfo) mPackageInfoList.get (i);
Log.v ("[*** PACKAGE ***]", pi.packageName);
/ / String name = mPackageManager.getApplicationLabel (pi.applicationInfo) toString ();.
}
}


Calling code fragment:
 getPackageInfos (); 
showPackageInfos ();

Reply:
And heavy, and he come top.
Reply:
Prawn, hurry to my rescue.
Their top, and sink.
Reply:
This is the Play Store com.android.vending package name.
 private void func () {
ComponentName componet = new ComponentName ("com.android.vending", "com.android.vending.AssetBrowserActivity");

Intent i = new Intent ();
i.setComponent (componet);
startActivity (i);
}

This method can start the Play Store.
To promote open, this method can launch any application, you can get there from PackageManager applied to the package name and class name of the main Activity, ComponentName these two parameters passed to it.
Reply:
During this time busy, sorry, Results posted late, huh, huh.

Get the name of the Lord Activity Paste the following code fragment according to the package name, for future reference in need of children's shoes.
Thanks for your help, thank you!

 PackageManager mPackageManager; 
List mPackageInfoList;


Call fragment:
 getPackageInfos (); 
showPackageInfos ();


Achieve fragment:
 private void getPackageInfos () {
mPackageManager = getPackageManager ();
mPackageInfoList = mPackageManager.getInstalledPackages (0);
}

private void showPackageInfos () {
Log.v (":", "(PACKAGE NAME LIST)");
for (int i = 0; i PackageInfo pi = (PackageInfo) mPackageInfoList.get (i);
Log.v (": [*** PACKAGE ***]",
pi.packageName + ':' + getPkgMainActivityName (pi.packageName));
}
}

No comments:

Post a Comment