android.widget.TextView#setRotation ( )源码实例Demo

下面列出了android.widget.TextView#setRotation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: PhotoMovie   文件: ActivityAnimSegment.java
@Override
public void drawFrame(Activity painter, float segmentProgress) {
    TextView textView = (TextView) painter.findViewById(android.R.id.content).findViewWithTag("text");
    textView.setRotation(segmentProgress * 7200);

    int maxX = (int) (mViewportRect.width() / 2);
    int maxY = (int) (mViewportRect.height() / 2);

    if (!(mTransX > -maxX && mTransX < maxX)) {
        mStepX = getRanStep();
        mStepX = mTransX > 0 ? -mStepX : mStepX;
    }
    mTransX += mStepX;

    if (!(mTransY > -maxY && mTransY < maxY)) {
        mStepY = getRanStep();
        mStepY = mTransY > 0 ? -mStepY : mStepY;
    }
    mTransY += mStepY;

    textView.setTranslationX(mTransX);
    textView.setTranslationY(mTransY);
}
 
源代码2 项目: TinderStack   文件: TinderCardView.java
private void init(Context context, AttributeSet attrs) {
    if (!isInEditMode()) {
        inflate(context, R.layout.tinder_card, this);

        imageView = (ImageView) findViewById(R.id.iv);
        displayNameTextView = (TextView) findViewById(R.id.display_name_tv);
        usernameTextView = (TextView) findViewById(R.id.username_tv);
        likeTextView = (TextView) findViewById(R.id.like_tv);
        nopeTextView = (TextView) findViewById(R.id.nope_tv);

        likeTextView.setRotation(-(BADGE_ROTATION_DEGREES));
        nopeTextView.setRotation(BADGE_ROTATION_DEGREES);

        screenWidth = DisplayUtility.getScreenWidth(context);
        leftBoundary =  screenWidth * (1.0f/6.0f); // Left 1/6 of screen
        rightBoundary = screenWidth * (5.0f/6.0f); // Right 1/6 of screen
        padding = DisplayUtility.dp2px(context, 16);

        setOnTouchListener(this);
    }
}
 
源代码3 项目: Android100x100   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.fichero_disenio_ejemplo);

	TextView miTexto = (TextView) findViewById(R.id.textView_idDelTextViewParaUtilizarEnJava);

	miTexto.setText(R.string.el_texto_cambiado_desde_java);

	int colorElegido = getResources().getColor(android.R.color.holo_green_light);
	miTexto.setBackgroundColor(colorElegido);

	miTexto.setRotation(45.0f);
}
 
源代码4 项目: android-apps   文件: MainActivity.java
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
	tv1 = (TextView) findViewById(R.id.tv1);
	tv2 = (TextView) findViewById(R.id.tv2);
	tv3 = (TextView) findViewById(R.id.tv3);
	tv4 = (TextView) findViewById(R.id.tv4);
	
	
	if( Build.VERSION.SDK_INT < 11 ){
		RotateAnimation ra = new RotateAnimation(0, 90);
		ra.setDuration(100);
		ra.setFillAfter(true);
		
		tv1.startAnimation(ra);
		tv2.startAnimation(ra);
		tv3.startAnimation(ra);
		tv4.startAnimation(ra);
		
	} else{
		try{
			tv1.setRotation(90);
			tv2.setRotation(45);
			tv3.setRotation(180);
			tv4.setRotation(-90);
		} catch(Exception e){
			e.printStackTrace();
		}
	}
	
	
}
 
源代码5 项目: android-apps   文件: MainActivity.java
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
	tv1 = (TextView) findViewById(R.id.tv1);
	tv2 = (TextView) findViewById(R.id.tv2);
	tv3 = (TextView) findViewById(R.id.tv3);
	tv4 = (TextView) findViewById(R.id.tv4);
	
	
	if( Build.VERSION.SDK_INT < 11 ){
		RotateAnimation ra = new RotateAnimation(0, 90);
		ra.setDuration(100);
		ra.setFillAfter(true);
		
		tv1.startAnimation(ra);
		tv2.startAnimation(ra);
		tv3.startAnimation(ra);
		tv4.startAnimation(ra);
		
	} else{
		try{
			tv1.setRotation(90);
			tv2.setRotation(45);
			tv3.setRotation(180);
			tv4.setRotation(-90);
		} catch(Exception e){
			e.printStackTrace();
		}
	}
	
	
}
 
源代码6 项目: 600SeriesAndroidUploader   文件: MainActivity.java
private void refreshDisplayCgm() {
    Log.d(TAG, "refreshDisplayCgm");

    mUiRefreshHandler.removeCallbacks(mUiRefreshRunnable);

    timeLastSGV = 0;

    TextView textViewBg = findViewById(R.id.textview_bg);
    TextView textViewUnits = findViewById(R.id.textview_units);
    if (dataStore.isMmolxl()) {
        textViewUnits.setText(R.string.glucose_mmol);
    } else {
        textViewUnits.setText(R.string.glucose_mgdl);
    }
    TextView textViewTrend = findViewById(R.id.textview_trend);

    String sgvString = "\u2014"; // &mdash;
    String trendString = "{ion_ios_minus_empty}";
    int trendRotation = 0;

    if (displayCgmResults.size() > 0) {
        timeLastSGV = displayCgmResults.last().getEventDate().getTime();
        sgvString = FormatKit.getInstance().formatAsGlucose(displayCgmResults.last().getSgv(), false, true);
        String trend = displayCgmResults.last().getCgmTrend();
        if (displayCgmResults.last().isEstimate()) {
            trendString = "{ion-ios-medical}";
        } else if (trend != null) {
            switch (PumpHistoryCGM.NS_TREND.valueOf(trend)) {
                case TRIPLE_UP:
                    trendString = "{ion_ios_arrow_thin_up}{ion_ios_arrow_thin_up}{ion_ios_arrow_thin_up}";
                    break;
                case DOUBLE_UP:
                    trendString = "{ion_ios_arrow_thin_up}{ion_ios_arrow_thin_up}";
                    break;
                case SINGLE_UP:
                    trendString = "{ion_ios_arrow_thin_up}";
                    break;
                case FOURTY_FIVE_UP:
                    trendRotation = -45;
                    trendString = "{ion_ios_arrow_thin_right}";
                    break;
                case FLAT:
                    trendString = "{ion_ios_arrow_thin_right}";
                    break;
                case FOURTY_FIVE_DOWN:
                    trendRotation = 45;
                    trendString = "{ion_ios_arrow_thin_right}";
                    break;
                case SINGLE_DOWN:
                    trendString = "{ion_ios_arrow_thin_down}";
                    break;
                case DOUBLE_DOWN:
                    trendString = "{ion_ios_arrow_thin_down}{ion_ios_arrow_thin_down}";
                    break;
                case TRIPLE_DOWN:
                    trendString = "{ion_ios_arrow_thin_down}{ion_ios_arrow_thin_down}{ion_ios_arrow_thin_down}";
                    break;
                default:
                    trendString = "{ion_ios_minus_empty}";
                    break;
            }
        }
    }

    textViewBg.setText(sgvString);
    textViewTrend.setText(trendString);
    textViewTrend.setRotation(trendRotation);

    mUiRefreshHandler.post(mUiRefreshRunnable);
}
 
源代码7 项目: PixaToon   文件: MainActivity.java
/**
     * OnCreate method
     * @param savedInstanceState
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

        checkAndRequestPermissions();

//      //  Hide navigation buttons and go full-screen, for devices without hardware navigation buttons
//      getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
//                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
//                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

        setContentView(R.layout.activity_main);

        mFilterManager = FilterManager.getInstance();
        mCameraViewerFragment = new CameraViewerFragment();
        mPictureViewerFragment = new PictureViewerFragment();
        mFilterSelectorFragment = new FilterSelectorFragment();

        mOpenPictureBtn = (ImageButton) findViewById(R.id.openPictureBtn);
        mSelectFilterBtn = (ImageButton) findViewById(R.id.selectFilterBtn);
        mOpenCameraBtn = (ImageButton) findViewById(R.id.openCameraBtn);
        mConfigFilterBtn = (ImageButton) findViewById(R.id.configFilterBtn);
        mCapturePictureBtn = (ImageButton) findViewById(R.id.capturePictureBtn);

        mMsgTextView = (TextView) findViewById(R.id.msgTextView);
        mHandler = new Handler();

        // Register onClick listeners
        mOpenPictureBtn.setOnClickListener(this);
        mSelectFilterBtn.setOnClickListener(this);
        mOpenCameraBtn.setOnClickListener(this);
        mConfigFilterBtn.setOnClickListener(this);
        mCapturePictureBtn.setOnClickListener(this);
        findViewById(R.id.filterViewer).setOnClickListener(this);

        // Load sketch texture
        loadSketchTexture(getApplicationContext().getResources(),
                R.drawable.sketch_texture);

        // Set camera viewer as default
        getFragmentManager()
                .beginTransaction()
                .add(R.id.filterViewer, mCameraViewerFragment)
                .commit();

        /**
         * Device orientation listener implementation to appropriately rotate button and filter icons on orientation change
         */
        mOrientationListener = new OrientationEventListener(this, SensorManager.SENSOR_DELAY_UI) {
            @Override
            public void onOrientationChanged(int orientation) {
                if(isOrientationLandscape(orientation) && mOrientation == Configuration.ORIENTATION_PORTRAIT) {
                    mOrientation = Configuration.ORIENTATION_LANDSCAPE;
                    mCapturePictureBtn.setRotation(90);
                    mOpenPictureBtn.setRotation(90);
                    mOpenCameraBtn.setRotation(90);
                    mSelectFilterBtn.setRotation(90);
                    mConfigFilterBtn.setRotation(90);
                    mMsgTextView.setRotation(90);
                    if(mFilterSelectorFragment.isVisible())
                        mFilterSelectorFragment.changeOrientation(mOrientation);
                }
                else if(isOrientationPortrait(orientation) && mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
                    mOrientation = Configuration.ORIENTATION_PORTRAIT;
                    mCapturePictureBtn.setRotation(0);
                    mOpenPictureBtn.setRotation(0);
                    mOpenCameraBtn.setRotation(0);
                    mSelectFilterBtn.setRotation(0);
                    mConfigFilterBtn.setRotation(0);
                    mMsgTextView.setRotation(0);
                    if(mFilterSelectorFragment.isVisible())
                        mFilterSelectorFragment.changeOrientation(mOrientation);
                }
            }
        };
    }
 
源代码8 项目: Androzic   文件: MapFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
	Log.e(TAG, "onCreateView()");

	View view = inflater.inflate(R.layout.fragment_map, container, false);

	coordinates = (TextView) view.findViewById(R.id.coordinates);
	satellites = (TextView) view.findViewById(R.id.sats);
	currentFile = (TextView) view.findViewById(R.id.currentfile);
	mapLicense = (TextView) view.findViewById(R.id.maplicense);
	mapLicense.setClickable(true);
	mapLicense.setMovementMethod(LinkMovementMethod.getInstance());
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
	{
		mapLicense.setRotation(-90);
		mapLicense.setPivotX(0);
		mapLicense.setPivotY(0);
	}
	mapZoom = (TextView) view.findViewById(R.id.currentzoom);
	waypointName = (TextView) view.findViewById(R.id.waypointname);
	waypointExtra = (TextView) view.findViewById(R.id.waypointextra);
	routeName = (TextView) view.findViewById(R.id.routename);
	routeExtra = (TextView) view.findViewById(R.id.routeextra);
	speedValue = (TextView) view.findViewById(R.id.speed);
	speedUnit = (TextView) view.findViewById(R.id.speedunit);
	trackValue = (TextView) view.findViewById(R.id.track);
	trackUnit = (TextView) view.findViewById(R.id.trackunit);
	elevationValue = (TextView) view.findViewById(R.id.elevation);
	elevationUnit = (TextView) view.findViewById(R.id.elevationunit);
	distanceValue = (TextView) view.findViewById(R.id.distance);
	distanceUnit = (TextView) view.findViewById(R.id.distanceunit);
	xtkValue = (TextView) view.findViewById(R.id.xtk);
	xtkUnit = (TextView) view.findViewById(R.id.xtkunit);
	bearingValue = (TextView) view.findViewById(R.id.bearing);
	bearingUnit = (TextView) view.findViewById(R.id.bearingunit);
	turnValue = (TextView) view.findViewById(R.id.turn);
	turnUnit = (TextView) view.findViewById(R.id.turnunit);
	// trackBar = (SeekBar) findViewById(R.id.trackbar);
	mapInfo = view.findViewById(R.id.mapinfo);
	satInfo = view.findViewById(R.id.satinfo);
	navInfo = view.findViewById(R.id.navinfo);
	mapButtons = view.findViewById(R.id.mapbuttons);
	waitBar = (TextView) view.findViewById(R.id.waitbar);
	anchor = view.findViewById(R.id.anchor);
	map = (MapView) view.findViewById(R.id.mapview);
	map.initialize(application, this);

	view.findViewById(R.id.zoomin).setOnClickListener(this);
	view.findViewById(R.id.zoomin).setOnTouchListener(this);
	view.findViewById(R.id.zoomout).setOnClickListener(this);
	view.findViewById(R.id.nextmap).setOnClickListener(this);
	view.findViewById(R.id.prevmap).setOnClickListener(this);
	coordinates.setOnClickListener(this);
	satellites.setOnClickListener(this);
	currentFile.setOnClickListener(this);
	mapZoom.setOnClickListener(this);
	waypointName.setOnClickListener(this);

	// set route edit button actions
	view.findViewById(R.id.finishrouteedit).setOnClickListener(this);
	view.findViewById(R.id.addpoint).setOnClickListener(this);
	view.findViewById(R.id.insertpoint).setOnClickListener(this);
	view.findViewById(R.id.removepoint).setOnClickListener(this);
	view.findViewById(R.id.orderpoints).setOnClickListener(this);

	application.setMapHolder(this);

	return view;
}
 
 方法所在类
 同类方法